Inheritance: implements TYPO3\Eel\ProtectedContextAwareInterface
Exemple #1
0
 /**
  * Serialize node and all child nodes
  *
  * @param NodeInterface $node
  * @param array $list
  * @return array
  */
 public function serializeNodeRecursively(NodeInterface $node, ControllerContext $controllerContext)
 {
     $result = [$node->getContextPath() => $this->nodeInfoHelper->renderNode($node, $controllerContext)];
     foreach ($node->getChildNodes() as $childNode) {
         $result = array_merge($result, $this->serializeNodeRecursively($childNode, $controllerContext));
     }
     return $result;
 }
 /**
  * Build and execute a flow query chain
  *
  * @param array $chain
  * @return void
  */
 public function flowQueryAction(array $chain)
 {
     $createContext = array_shift($chain);
     $finisher = array_pop($chain);
     $flowQuery = new FlowQuery(array_map(function ($envelope) {
         return $this->nodeService->getNodeFromContextPath($envelope['$node']);
     }, $createContext['payload']));
     foreach ($chain as $operation) {
         $flowQuery = call_user_func_array([$flowQuery, strtolower($operation['type'])], $operation['payload']);
     }
     if ('GET' === $finisher['type']) {
         $result = $flowQuery->get();
     }
     $nodeInfoHelper = new NodeInfoHelper();
     return json_encode($nodeInfoHelper->renderNodes($result, $this->getControllerContext()));
 }