public static function appendAssets() { if (self::$assets_loaded === false && class_exists('Administration') && Administration::instance() instanceof Administration && Administration::instance()->Page instanceof HTMLPage) { self::$assets_loaded = true; $page = Administration::instance()->Page; $page->addStylesheetToHead(URL . '/extensions/frontend_localisation/assets/frontend_localisation.multilingual_tabs.css', 'screen', null, false); $page->addScriptToHead(URL . '/extensions/frontend_localisation/assets/frontend_localisation.multilingual_tabs.js', null, false); $page->addScriptToHead(URL . '/extensions/frontend_localisation/assets/frontend_localisation.multilingual_tabs_init.js', null, false); } }
/** * Append localised Title and Handle fields to Page edit menu. * * @param array $context - see delegate description */ public function dAppendPageContent($context) { Extension_Frontend_Localisation::appendAssets(); $main_lang = FLang::getMainLang(); $all_langs = FLang::getAllLangs(); $langs = FLang::getLangs(); $fieldset = new XMLElement('fieldset', null, array('class' => 'settings')); $fieldset->appendChild(new XMLElement('legend', __('Page LHandles'))); $container = new XMLElement('div', null, array('class' => 'field-multilingual')); /*------------------------------------------------------------------------------------------------*/ /* Tabs */ /*------------------------------------------------------------------------------------------------*/ $ul = new XMLElement('ul', null, array('class' => 'tabs')); foreach ($langs as $lc) { $li = new XMLElement('li', $all_langs[$lc], array('class' => $lc)); $lc === $main_lang ? $ul->prependChild($li) : $ul->appendChild($li); } $container->appendChild($ul); /*------------------------------------------------------------------------------------------------*/ /* Panels */ /*------------------------------------------------------------------------------------------------*/ foreach ($langs as $lc) { // title $container->appendChild(Widget::Label(__('Localised Title'), Widget::Input("fields[plh_t-" . $lc . "]", $context['fields']['plh_t-' . $lc], 'text', array('length', '30')), 'tab-panel tab-' . $lc . ' tab-title', null, array('style' => 'margin-bottom: 0;border-bottom: none;'))); // handle $container->appendChild(Widget::Label(__('Localised URL Handle'), Widget::Input("fields[plh_h-" . $lc . "]", $context['fields']['plh_h-' . $lc], 'text', array('length', '30')), 'tab-panel tab-' . $lc . ' tab-handle')); } $fieldset->appendChild($container); $context['form']->prependChild($fieldset); }