Neos\Neos\Controller\Backend\ContentController::masterPluginsAction PHP Метод

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

Fetch all master plugins that are available in the current workspace.
public masterPluginsAction ( string $workspaceName = 'live', array $dimensions = [] ) : string
$workspaceName string Name of the workspace to use for querying the node
$dimensions array Optional list of dimensions and their values which should be used for querying the specified node
Результат string JSON encoded array of node path => label
    public function masterPluginsAction($workspaceName = 'live', array $dimensions = array())
    {
        $this->response->setHeader('Content-Type', 'application/json');
        $contentContext = $this->createContentContext($workspaceName, $dimensions);
        $pluginNodes = $this->pluginService->getPluginNodesWithViewDefinitions($contentContext);
        $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 Neos.Neos:Document]')->get(0);
                if ($page === null) {
                    continue;
                }
                $translationHelper = new TranslationHelper();
                $masterPlugins[$pluginNode->getIdentifier()] = $translationHelper->translate('masterPlugins.nodeTypeOnPageLabel', null, ['nodeTypeName' => $translationHelper->translate($pluginNode->getNodeType()->getLabel()), 'pageLabel' => $page->getLabel()], 'Main', 'Neos.Neos');
            }
        }
        return json_encode((object) $masterPlugins);
    }