コード例 #1
0
 /**
  * Fetch all master plugins that are available in the current
  * workspace.
  *
  * @param NodeInterface $node
  * @return string JSON encoded array of node path => label
  */
 public function masterPluginsAction(NodeInterface $node)
 {
     $this->response->setHeader('Content-Type', 'application/json');
     $pluginNodes = $this->pluginService->getPluginNodesWithViewDefinitions($node->getContext());
     $masterPlugins = array();
     if (is_array($pluginNodes)) {
         /** @var $pluginNode NodeInterface */
         foreach ($pluginNodes as $pluginNode) {
             if ($pluginNode->isRemoved()) {
                 continue;
             }
             $q = new FlowQuery(array($pluginNode));
             $page = $q->closest('[instanceof TYPO3.Neos:Document]')->get(0);
             if ($page === NULL) {
                 continue;
             }
             $masterPlugins[$pluginNode->getPath()] = sprintf('"%s" on page "%s"', $pluginNode->getNodeType()->getLabel(), $page->getLabel());
         }
     }
     return json_encode((object) $masterPlugins);
 }
コード例 #2
0
 /**
  * Fetch all master plugins that are available in the current
  * workspace.
  *
  * @param NodeInterface $node
  * @return string JSON encoded array of node path => label
  */
 public function masterPluginsAction(NodeInterface $node)
 {
     $this->response->setHeader('Content-Type', 'application/json');
     $pluginNodes = $this->pluginService->getPluginNodesWithViewDefinitions($node->getContext());
     $masterPlugins = array();
     if (is_array($pluginNodes)) {
         /** @var $pluginNode NodeInterface */
         foreach ($pluginNodes as $pluginNode) {
             if ($pluginNode->isRemoved()) {
                 continue;
             }
             $q = new FlowQuery(array($pluginNode));
             $page = $q->closest('[instanceof TYPO3.Neos:Document]')->get(0);
             if ($page === null) {
                 continue;
             }
             $translationHelper = new TranslationHelper();
             $masterPlugins[$pluginNode->getPath()] = $translationHelper->translate('masterPlugins.nodeTypeOnPageLabel', null, ['nodeTypeName' => $translationHelper->translate($pluginNode->getNodeType()->getLabel()), 'pageLabel' => $page->getLabel()], 'Main', 'TYPO3.Neos');
         }
     }
     return json_encode((object) $masterPlugins);
 }