Neos\Neos\Service\PluginService::getPluginNodeByAction PHP Метод

getPluginNodeByAction() публичный Метод

returns a plugin node or one of it's view nodes if an view has been configured for that specific controller and action combination
public getPluginNodeByAction ( Neos\ContentRepository\Domain\Model\NodeInterface $currentNode, string $controllerObjectName, string $actionName ) : Neos\ContentRepository\Domain\Model\NodeInterface
$currentNode Neos\ContentRepository\Domain\Model\NodeInterface
$controllerObjectName string
$actionName string
Результат Neos\ContentRepository\Domain\Model\NodeInterface
    public function getPluginNodeByAction(NodeInterface $currentNode, $controllerObjectName, $actionName)
    {
        $viewDefinition = $this->getPluginViewDefinitionByAction($controllerObjectName, $actionName);
        if ($currentNode->getNodeType()->isOfType('Neos.Neos:PluginView')) {
            $masterPluginNode = $this->getPluginViewNodeByMasterPlugin($currentNode, $viewDefinition->getName());
        } else {
            $masterPluginNode = $currentNode;
        }
        if ($viewDefinition !== null) {
            $viewNode = $this->getPluginViewNodeByMasterPlugin($currentNode, $viewDefinition->getName());
            if ($viewNode instanceof Node) {
                return $viewNode;
            }
        }
        return $masterPluginNode;
    }

Usage Example

 /**
  * @Flow\Around("method(Neos\Flow\Mvc\Routing\UriBuilder->uriFor())")
  * @param \Neos\Flow\Aop\JoinPointInterface $joinPoint The current join point
  * @return string The result of the target method if it has not been intercepted
  */
 public function rewritePluginViewUris(JoinPointInterface $joinPoint)
 {
     /** @var ActionRequest $request */
     $request = $joinPoint->getProxy()->getRequest();
     $arguments = $joinPoint->getMethodArguments();
     $currentNode = $request->getInternalArgument('__node');
     if (!$request->getMainRequest()->hasArgument('node') || !$currentNode instanceof Node) {
         return $joinPoint->getAdviceChain()->proceed($joinPoint);
     }
     $currentNode = $request->getInternalArgument('__node');
     $controllerObjectName = $this->getControllerObjectName($request, $arguments);
     $actionName = $arguments['actionName'] !== null ? $arguments['actionName'] : $request->getControllerActionName();
     $targetNode = $this->pluginService->getPluginNodeByAction($currentNode, $controllerObjectName, $actionName);
     // TODO override namespace
     $q = new FlowQuery(array($targetNode));
     $pageNode = $q->closest('[instanceof Neos.Neos:Document]')->get(0);
     $result = $this->generateUriForNode($request, $joinPoint, $pageNode);
     return $result;
 }