AdminCTTopMenuItemController::renderForm PHP Метод

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

Renders menu item add/edit form
public renderForm ( ) : string
Результат string
    public function renderForm()
    {
        $this->fields_form = array('legend' => array('title' => $this->l('Edit/Add page top menu item')), 'input' => array(array('name' => 'type', 'type' => 'select', 'label' => $this->l('Item type'), 'desc' => $this->l('Select menu item type. This can be a link to an page (object) in PrestaShop, a tree of objects (categories), lists (manufacturers, suppliers), or custom links.'), 'cast' => 'strval', 'default_value' => CTTopMenuItem::TYPE_CUSTOM_LINK, 'options' => array('id' => 'id', 'name' => 'name', 'query' => $this->menuItemTypes)), array('name' => 'entity_id', 'type' => 'text', 'label' => $this->l('Entity ID'), 'desc' => $this->l('Enter the ID of the selected item (object) type. For example, enter product ID or category ID.'), 'hint' => $this->l('Must be an integer greater than 0 and must exists in the shop.')), array('name' => 'tree_max_depth', 'type' => 'text', 'label' => $this->l('Tree Max Depth'), 'desc' => $this->l('For category trees, enter maximum depth of that tree. For example, you may want to display only level 2 categories in the drop down menu.'), 'cast' => 'intval', 'hint' => $this->l('Enter 0 for no limit.')), array('name' => 'name', 'type' => 'text', 'lang' => true, 'label' => $this->l('Name'), 'desc' => $this->l('Enter the menu item name for your custom link or override the link name of PrestaShop objects which are objects names.'), 'cast' => 'strval'), array('name' => 'url', 'type' => 'text', 'lang' => true, 'label' => $this->l('URL'), 'desc' => $this->l('Enter a URL for your custom link or override the menu item URL of PrestaShop object menu item.'), 'cast' => 'strval', 'hint' => $this->l('Can be either absolute or relative URL.')), array('name' => 'title', 'type' => 'text', 'lang' => true, 'label' => $this->l('Hover Title'), 'desc' => $this->l('Will be displayed on mouse hover over the menu item.'), 'cast' => 'strval'), array('name' => 'icon', 'type' => 'text', 'label' => $this->l('Icon'), 'desc' => sprintf($this->l('You may use icons together with the menu item name. Refer to %s for font icon codes.'), '<a href="https://fortawesome.github.io/Font-Awesome/icons/" target="_blank">Font Awesome</a>'), 'cast' => 'strval', 'hint' => $this->l('Do not enter the fa- or icon- part of the class name.')), array('name' => 'class', 'type' => 'text', 'label' => $this->l('CSS Class'), 'desc' => $this->l('You may add some extra CSS classes to this menu item to give it exclusive styling.'), 'cast' => 'strval'), array('type' => 'switch', 'label' => $this->l('No Follow'), 'name' => 'no_follow', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'no_follow_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'no_follow_off', 'value' => 0, 'label' => $this->l('No'))), 'desc' => $this->l('If enabled, the menu item link will have rel="nofollow" attribute.')), array('type' => 'switch', 'label' => $this->l('Active'), 'name' => 'active', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('No'))), 'desc' => $this->l('If disabled, menu item will not be displayed.'))), 'submit' => array('title' => $this->l('Save')));
        $this->addCSS($this->module->getLocalPath() . 'views/css/vendor/typeaheadjs.css');
        $this->addJS($this->module->getLocalPath() . 'views/js/vendor/typeahead.bundle.min.js');
        $this->addJS($this->module->getLocalPath() . 'views/js/bo.js');
        $iconListFilePath = _MODULE_DIR_ . $this->module->name . '/views/json/icons.json';
        if (file_exists(_PS_THEME_DIR_ . 'modules/' . $this->module->name . '/views/json/icons.json')) {
            $iconListFilePath = _THEME_DIR_ . 'modules/' . $this->module->name . '/views/json/icons.json';
        }
        $classListFilePath = _MODULE_DIR_ . $this->module->name . '/views/json/classes.json';
        if (file_exists(_PS_THEME_DIR_ . 'modules/' . $this->module->name . '/views/json/classes.json')) {
            $classListFilePath = _THEME_DIR_ . 'modules/' . $this->module->name . '/views/json/classes.json';
        }
        Media::addJsDef(array('cttopmenu' => array('icon_list_filepath' => $iconListFilePath, 'class_list_filepath' => $classListFilePath, 'menu_item_types' => $this->menuItemTypes)));
        // @TODO Always show?
        if (Shop::isFeatureActive()) {
            $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso');
        }
        return parent::renderForm();
    }