typo3typoscripttypo3-flowneoscms

Typo3 Neos: How to pass parameter from typoscript using 'TYPO3.Neos:Plugin'?


i wanted to pass a parameter dynamically via aloha editor, i have select box like this on .yaml

properties:
 events:
  type: string
  ui:
    label: 'Events'
    reloadIfChanged: TRUE
    inspector:
      group: 'document'
      editor: 'TYPO3.Neos/Inspector/Editors/SelectBoxEditor'
      editorOptions:
        dataSourceUri: 'events/list'

and on .ts2 file i use this

prototype(Festival.Backend:Events) < prototype(TYPO3.Neos:Plugin) {
    package = 'Festival.Backend'
    controller = 'Events'
    action = 'ast_view'
    artist = ${q(node).property('events')}
}

in this tutorial http://docs.typo3.org/neos/TYPO3NeosDocumentation/Appendixes/NeosTypoScriptReference.html# it says that i can pass a parameter to the controller using

argumentNamespace:
[key]:

my question is how do i add the 'artist' value from node property to the controller action? something like this

public function ast_viewAction($artist) {
    $this->view->assign('artist', $artist); 
}

thanks for your attention

EDIT: solved thanks to Aske Ertmann, change my function to this

 public function ast_viewAction() {
    $events_artist = $this->request->getInternalArgument('__artist');
    $this->view->assign('artist', $artist); 
}

Solution

  • The arguments from the TypoScript plugin object is available as internal arguments on the request, which is available in the controller action.

    /** @var \TYPO3\TYPO3CR\Domain\Model\Node $currentNode */
    $currentNode = $this->request->getInternalArgument('__node');
    

    A few additional tips can be found here