[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_menus/tmpl/item/ -> edit.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_menus
   6   *
   7   * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') or die;
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\HTML\HTMLHelper;
  15  use Joomla\CMS\Language\Associations;
  16  use Joomla\CMS\Language\Text;
  17  use Joomla\CMS\Layout\LayoutHelper;
  18  use Joomla\CMS\Router\Route;
  19  
  20  $this->useCoreUI = true;
  21  
  22  Text::script('ERROR');
  23  Text::script('JGLOBAL_VALIDATION_FORM_FAILED');
  24  
  25  $this->document->addScriptOptions('menu-item', ['itemId' => (int) $this->item->id]);
  26  
  27  /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
  28  $wa = $this->document->getWebAssetManager();
  29  $wa->useScript('keepalive')
  30      ->useScript('form.validate')
  31      ->useScript('com_menus.admin-item-edit');
  32  
  33  $assoc = Associations::isEnabled();
  34  $input = Factory::getApplication()->input;
  35  
  36  // In case of modal
  37  $isModal  = $input->get('layout') === 'modal';
  38  $layout   = $isModal ? 'modal' : 'edit';
  39  $tmpl     = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : '';
  40  $clientId = $this->state->get('item.client_id', 0);
  41  $lang     = Factory::getLanguage()->getTag();
  42  
  43  // Load mod_menu.ini file when client is administrator
  44  if ($clientId === 1) {
  45      Factory::getLanguage()->load('mod_menu', JPATH_ADMINISTRATOR);
  46  }
  47  ?>
  48  <form action="<?php echo Route::_('index.php?option=com_menus&view=item&client_id=' . $clientId . '&layout=' . $layout . $tmpl . '&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" aria-label="<?php echo Text::_('COM_MENUS_ITEM_FORM_' . ((int) $this->item->id === 0 ? 'NEW' : 'EDIT'), true); ?>" class="form-validate">
  49  
  50      <?php echo LayoutHelper::render('joomla.edit.title_alias', $this); ?>
  51  
  52      <?php // Add the translation of the menu item title when client is administrator ?>
  53      <?php if ($clientId === 1 && $this->item->id != 0) : ?>
  54          <div class="row title-alias form-vertical mb-3">
  55              <div class="col-12">
  56                  <div class="control-group">
  57                      <div class="control-label">
  58                          <label for="menus_title_translation"><?php echo Text::sprintf('COM_MENUS_TITLE_TRANSLATION', $lang); ?></label>
  59                      </div>
  60                      <div class="controls">
  61                          <input id="menus_title_translation" class="form-control" value="<?php echo Text::_($this->item->title); ?>" readonly="readonly" type="text">
  62                      </div>
  63                  </div>
  64              </div>
  65          </div>
  66      <?php endif; ?>
  67  
  68      <div class="main-card">
  69  
  70          <?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', ['active' => 'details', 'recall' => true, 'breakpoint' => 768]); ?>
  71  
  72          <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'details', Text::_('COM_MENUS_ITEM_DETAILS')); ?>
  73          <div class="row">
  74              <div class="col-lg-9">
  75                  <?php
  76                  echo $this->form->renderField('type');
  77  
  78                  if ($this->item->type == 'alias') {
  79                      echo $this->form->renderField('aliasoptions', 'params');
  80                  }
  81  
  82                  if ($this->item->type == 'separator') {
  83                      echo $this->form->renderField('text_separator', 'params');
  84                  }
  85  
  86                  echo $this->form->renderFieldset('request');
  87  
  88                  if ($this->item->type == 'url') {
  89                      $this->form->setFieldAttribute('link', 'readonly', 'false');
  90                      $this->form->setFieldAttribute('link', 'required', 'true');
  91                  }
  92  
  93                  echo $this->form->renderField('link');
  94  
  95                  if ($this->item->type == 'alias') {
  96                      echo $this->form->renderField('alias_redirect', 'params');
  97                  }
  98  
  99                  echo $this->form->renderField('browserNav');
 100                  echo $this->form->renderField('template_style_id');
 101  
 102                  if (!$isModal && $this->item->type == 'container') {
 103                      echo $this->loadTemplate('container');
 104                  }
 105                  ?>
 106              </div>
 107              <div class="col-lg-3">
 108                  <?php
 109                      // Set main fields.
 110                      $this->fields = array(
 111                          'id',
 112                          'client_id',
 113                          'menutype',
 114                          'parent_id',
 115                          'menuordering',
 116                          'published',
 117                          'publish_up',
 118                          'publish_down',
 119                          'home',
 120                          'access',
 121                          'language',
 122                          'note',
 123                      );
 124  
 125                      if ($this->item->type != 'component') {
 126                          $this->fields = array_diff($this->fields, array('home'));
 127                          $this->form->setFieldAttribute('publish_up', 'showon', '');
 128                          $this->form->setFieldAttribute('publish_down', 'showon', '');
 129                      }
 130                      ?>
 131                  <?php
 132                      // Set main fields.
 133                      $this->fields = array(
 134                          'id',
 135                          'client_id',
 136                          'menutype',
 137                          'parent_id',
 138                          'menuordering',
 139                          'published',
 140                          'home',
 141                          'publish_up',
 142                          'publish_down',
 143                          'access',
 144                          'language',
 145                          'note',
 146                      );
 147  
 148                      if ($this->item->type != 'component') {
 149                          $this->fields = array_diff($this->fields, array('home'));
 150                          $this->form->setFieldAttribute('publish_up', 'showon', '');
 151                          $this->form->setFieldAttribute('publish_down', 'showon', '');
 152                      }
 153  
 154                      echo LayoutHelper::render('joomla.edit.global', $this); ?>
 155              </div>
 156          </div>
 157          <?php echo HTMLHelper::_('uitab.endTab'); ?>
 158  
 159          <?php
 160          $this->fieldsets = array();
 161          $this->ignore_fieldsets = array('aliasoptions', 'request', 'item_associations');
 162          echo LayoutHelper::render('joomla.edit.params', $this);
 163          ?>
 164  
 165          <?php if (!$isModal && $assoc && $this->state->get('item.client_id') != 1) : ?>
 166              <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'associations', Text::_('JGLOBAL_FIELDSET_ASSOCIATIONS')); ?>
 167              <fieldset id="fieldset-associations" class="options-form">
 168              <legend><?php echo Text::_('JGLOBAL_FIELDSET_ASSOCIATIONS'); ?></legend>
 169              <div>
 170              <?php echo LayoutHelper::render('joomla.edit.associations', $this); ?>
 171              </div>
 172              </fieldset>
 173              <?php echo HTMLHelper::_('uitab.endTab'); ?>
 174          <?php elseif ($isModal && $assoc) : ?>
 175              <div class="hidden"><?php echo LayoutHelper::render('joomla.edit.associations', $this); ?></div>
 176          <?php endif; ?>
 177  
 178          <?php if (!empty($this->modules)) : ?>
 179              <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'modules', Text::_('COM_MENUS_ITEM_MODULE_ASSIGNMENT')); ?>
 180              <fieldset id="fieldset-modules" class="options-form">
 181                  <legend><?php echo Text::_('COM_MENUS_ITEM_MODULE_ASSIGNMENT'); ?></legend>
 182                  <div>
 183                  <?php echo $this->loadTemplate('modules'); ?>
 184                  </div>
 185              </fieldset>
 186              <?php echo HTMLHelper::_('uitab.endTab'); ?>
 187          <?php endif; ?>
 188  
 189          <?php echo HTMLHelper::_('uitab.endTabSet'); ?>
 190      </div>
 191  
 192      <input type="hidden" name="task" value="">
 193      <input type="hidden" name="forcedLanguage" value="<?php echo $input->get('forcedLanguage', '', 'cmd'); ?>">
 194      <input type="hidden" name="menutype" value="<?php echo $input->get('menutype', '', 'cmd'); ?>">
 195      <?php echo $this->form->getInput('component_id'); ?>
 196      <?php echo HTMLHelper::_('form.token'); ?>
 197      <input type="hidden" id="fieldtype" name="fieldtype" value="">
 198  </form>


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer