[TYPO3-mvc] passing value to another plugin (i.e. action not in the flow)
christian oettinger
christian.oettinger at gmx.de
Fri Mar 25 21:25:38 CET 2011
Hi Peter, thanks for helping!
I'll try to make it more clear.
Let's forget about my request tries (that's probably wise...) and go
back to standard (as seen below):
Two Plugins are in one Controller (TrainingController). The first plugin
(Plugin Name "Search", leading to searchboxAction) shows the searchbox form.
It does pass the entered value to the second plugin (Plugin Name
"Training", leading (in this case) to createSearchAction ->
listSearchedAction), which shows the list of objects found.
This is easy and already works perfect. But I want to pass the entered
value to the searchbox plugin (i.e. searchboxAction()) AS WELL. So I
have one plugin that passes a value to another plugin AND to itself.
(Reason for that: searchbox plugin is found on each page and shall not
loose its value. This is just a "should have" but I can't believe it is
hard to do?)
Is this more clear?
cheers!
christian (oe)
We start the flow here:
-- inside my searchboxView: --
<f:form method="post" action="createSearch" name="newSearch"
object="{newSearch}" pageUid="{f:cObject(typoscriptObjectPath:
'lib.resultPage')}" pluginName="Trainings" >
--------
-- Inside TrainingController: --
/**
* Displays Searchbox
* @return string The rendered view
*/
public function searchboxAction() {
}
/**
* create Search
*
* @return string The rendered list view
* @param Tx_Arztcme_Domain_Model_Search $newSearch
* @validate $newSearch
*/
public function createSearchAction(Tx_Arztcme_Domain_Model_Search
$newSearch) {
// persist search...
$this->redirect('listSearched','Training','arztcme',array('search'=>$newSearch));
}
/**
* Displays searched Trainings
* @param Tx_Arztcme_Domain_Model_Search $search
* @return string The rendered list view
*/
public function listSearchedAction(Tx_Arztcme_Domain_Model_Search
$search = NULL) {
if($search){
$trainings = $this->trainingRepository->findSearched($search);
$topics = $this->topicRepository->findRelated($trainings);
$this->view->assign('targetPage', $this->settings['targetPage']);
$this->view->assign('topics', $topics);
$this->view->assign('trainings', $trainings);
$this->view->assign('search', $search);
$this->view->assign('doctor', $this->doctor);
}
}
--------
-- ext_tables.php --
Tx_Extbase_Utility_Extension::registerPlugin(
$_EXTKEY,
'Trainings',
'Fortbildungen'
);
$TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY .
'_trainings'] = 'pi_flexform';
t3lib_extMgm::addPiFlexFormValue($_EXTKEY . '_trainings', 'FILE:EXT:' .
$_EXTKEY . '/Configuration/FlexForms/flexform_trainings.xml');
Tx_Extbase_Utility_Extension::registerPlugin(
$_EXTKEY,
'Search',
'Suche'
);
$TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY .
'_search'] = 'pi_flexform';
t3lib_extMgm::addPiFlexFormValue($_EXTKEY . '_search', 'FILE:EXT:' .
$_EXTKEY . '/Configuration/FlexForms/flexform_search.xml');
--------
(The flexform configuration shold not be disturbing as evrything works
well. The same can be said for other plugins/actions. I don't list them
for thy should not interfere.)
-- ext_localconf.php --
Tx_Extbase_Utility_Extension::configurePlugin(
$_EXTKEY,
'Trainings',
array(
'Training' => 'listAll, listNew, listInteresting, listFinished,
listSearched, createSearch, createVnrSearch, show, helptext',
'Participation' => 'showResult, showResult2, new, new2, create,
create2, delete',
'Delivery' => 'list, show, new, create, edit, update, delete',
'Evaluation' => 'show, new, create, edit, update, delete',
'Doctor' => 'list, show, new, create, edit, update, delete',
'Field' => 'list, show, new, create, edit, update, delete',
'Author' => 'list, show, new, create, edit, update, delete',
'Topic' => 'show, new, create, edit, update, delete',
),
array(
'Training' => 'createSearch, createVnrSearch',
'Participation' => 'create, create2, delete',
'Delivery' => 'create, update, delete',
'Evaluation' => 'create, update, delete',
'Topic' => 'create, update, delete',
'Doctor' => 'create, update, delete',
'Field' => 'create, update, delete',
'Author' => 'create, update, delete',
)
);
Tx_Extbase_Utility_Extension::configurePlugin(
$_EXTKEY,
'Search',
array(
'Training' => 'searchbox, vnrSearchbox',
),
array(
'Training' => 'searchbox, vnrSearchbox',
)
);
More information about the TYPO3-project-typo3v4mvc
mailing list