/** * Prepares TinyMCE with all the nodes from the site tree * @param zibo\tinymce\controller\TinyMCEController $controller The TinyMCE controller * @return null */ public function prepareTinyMCE(TinyMCEController $controller) { $modelManager = ModelManager::getInstance(); $nodeModel = $modelManager->getModel(NodeModel::NAME); $siteModel = $modelManager->getModel(SiteModel::NAME); $sites = $siteModel->getSites(); foreach ($sites as $site) { $nodeTree = $siteModel->getNodeTreeForSite($site); $nodeList = $nodeModel->createListFromNodeTree($nodeTree); $prefix = ''; if (count($sites) > 1) { $prefix = '/' . $site->node->name; } foreach ($nodeList as $nodeId => $nodeName) { $controller->addLink('%node.' . $nodeId . '.url%', $prefix . $nodeName); } } }
/** * Hook with TinyMCE to add files from the user directory to the anchor field * @param zibo\tinymce\controller\TinyMCEController $controller The TinyMCE controller * @return null */ public function addLinksToTinyMCE(TinyMCEController $controller) { if (!$this->isUserDirectoryEnabled()) { return; } $files = $this->getTinyMCEFiles(); foreach ($files as $link => $label) { $controller->addLink($link, $label); } }