Skip to content

Instantly share code, notes, and snippets.

@sbruggmann
Created February 10, 2015 09:08
Show Gist options
  • Save sbruggmann/5b4557f5ee338db55444 to your computer and use it in GitHub Desktop.
Save sbruggmann/5b4557f5ee338db55444 to your computer and use it in GitHub Desktop.
Access Nodes in a TYPO3 Neos Package Controller
<?php
namespace My\Package\Controller;
class PersonsController extends ActionController {
/**
* @return void
*/
public function personsAction() {
$currentDocumentNode = $this->request->getInternalArgument('__documentNode');
if ($currentDocumentNode !== NULL) {
$parentNode = $currentDocumentNode->getParent();
$personsNode = $parentNode->getNode('persons');
foreach ($personsNode->getChildNodes() as $personNode) {
if ( $personNode->getProperty('maincontactfor') ) {
// do something great..
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment