/**
* Fetch all master plugins that are available in the current
* workspace.
*
* @param string $workspaceName Name of the workspace to use for querying the node
* @param array $dimensions Optional list of dimensions and their values which should be used for querying the specified node
* @return 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);
}