[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_modules/tmpl/module/ -> edit.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_modules
   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\Text;
  16  use Joomla\CMS\Layout\LayoutHelper;
  17  use Joomla\CMS\Router\Route;
  18  
  19  HTMLHelper::_('behavior.combobox');
  20  
  21  $hasContent = isset($this->item->xml->customContent);
  22  $hasContentFieldName = 'content';
  23  
  24  // For a later improvement
  25  if ($hasContent) {
  26      $hasContentFieldName = 'content';
  27  }
  28  
  29  // Get Params Fieldsets
  30  $this->fieldsets = $this->form->getFieldsets('params');
  31  $this->useCoreUI = true;
  32  
  33  Text::script('JYES');
  34  Text::script('JNO');
  35  Text::script('JALL');
  36  Text::script('JTRASHED');
  37  
  38  $this->document->addScriptOptions('module-edit', ['itemId' => $this->item->id, 'state' => (int) $this->item->id == 0 ? 'Add' : 'Edit']);
  39  
  40  /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
  41  $wa = $this->document->getWebAssetManager();
  42  $wa->useScript('keepalive')
  43      ->useScript('form.validate')
  44      ->useScript('com_modules.admin-module-edit');
  45  
  46  $input = Factory::getApplication()->input;
  47  
  48  // In case of modal
  49  $isModal = $input->get('layout') === 'modal';
  50  $layout  = $isModal ? 'modal' : 'edit';
  51  $tmpl    = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : '';
  52  
  53  ?>
  54  
  55  <form action="<?php echo Route::_('index.php?option=com_modules&layout=' . $layout . $tmpl . '&client_id=' . $this->form->getValue('client_id') . '&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="module-form" aria-label="<?php echo Text::_('COM_MODULES_FORM_TITLE_' . ((int) $this->item->id === 0 ? 'NEW' : 'EDIT'), true); ?>" class="form-validate">
  56  
  57      <?php echo LayoutHelper::render('joomla.edit.title_alias', $this); ?>
  58  
  59      <div class="main-card">
  60          <?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', ['active' => 'general', 'recall' => true, 'breakpoint' => 768]); ?>
  61  
  62          <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'general', Text::_('COM_MODULES_MODULE')); ?>
  63  
  64          <div class="row">
  65              <div class="col-lg-9">
  66                  <?php if ($this->item->xml) : ?>
  67                      <?php if ($this->item->xml->description) : ?>
  68                          <h2>
  69                              <?php
  70                              if ($this->item->xml) {
  71                                  echo ($text = (string) $this->item->xml->name) ? Text::_($text) : $this->item->module;
  72                              } else {
  73                                  echo Text::_('COM_MODULES_ERR_XML');
  74                              }
  75                              ?>
  76                          </h2>
  77                          <div class="info-labels">
  78                              <span class="badge bg-secondary">
  79                                  <?php echo $this->item->client_id == 0 ? Text::_('JSITE') : Text::_('JADMINISTRATOR'); ?>
  80                              </span>
  81                          </div>
  82                          <div>
  83                              <?php
  84                              $this->fieldset    = 'description';
  85                              $short_description = Text::_($this->item->xml->description);
  86                              $long_description  = LayoutHelper::render('joomla.edit.fieldset', $this);
  87  
  88                              if (!$long_description) {
  89                                  $truncated = HTMLHelper::_('string.truncate', $short_description, 550, true, false);
  90  
  91                                  if (strlen($truncated) > 500) {
  92                                      $long_description  = $short_description;
  93                                      $short_description = HTMLHelper::_('string.truncate', $truncated, 250);
  94  
  95                                      if ($short_description == $long_description) {
  96                                          $long_description = '';
  97                                      }
  98                                  }
  99                              }
 100                              ?>
 101                              <p><?php echo $short_description; ?></p>
 102                              <?php if ($long_description) : ?>
 103                                  <p class="readmore">
 104                                      <a href="#" onclick="document.getElementById('myTab').activateTab(document.getElementById('description'));">
 105                                          <?php echo Text::_('JGLOBAL_SHOW_FULL_DESCRIPTION'); ?>
 106                                      </a>
 107                                  </p>
 108                              <?php endif; ?>
 109                          </div>
 110                      <?php endif; ?>
 111                  <?php else : ?>
 112                      <div class="alert alert-danger">
 113                          <span class="icon-exclamation-triangle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('ERROR'); ?></span>
 114                          <?php echo Text::_('COM_MODULES_ERR_XML'); ?>
 115                      </div>
 116                  <?php endif; ?>
 117                  <?php
 118                  if ($hasContent) {
 119                      echo $this->form->getInput($hasContentFieldName);
 120                  }
 121                  $this->fieldset = 'basic';
 122                  $html = LayoutHelper::render('joomla.edit.fieldset', $this);
 123                  echo $html ? '<hr>' . $html : '';
 124                  ?>
 125              </div>
 126              <div class="col-lg-3">
 127                  <?php
 128                  // Set main fields.
 129                  $this->fields = array(
 130                      'showtitle',
 131                      'position',
 132                      'published',
 133                      'publish_up',
 134                      'publish_down',
 135                      'access',
 136                      'ordering',
 137                      'language',
 138                      'note'
 139                  );
 140  
 141                  ?>
 142                  <?php if ($this->item->client_id == 0) : ?>
 143                      <?php echo LayoutHelper::render('joomla.edit.global', $this); ?>
 144                  <?php else : ?>
 145                      <?php echo LayoutHelper::render('joomla.edit.admin_modules', $this); ?>
 146                  <?php endif; ?>
 147              </div>
 148          </div>
 149          <?php echo HTMLHelper::_('uitab.endTab'); ?>
 150  
 151          <?php if (isset($long_description) && $long_description != '') : ?>
 152              <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'description', Text::_('JGLOBAL_FIELDSET_DESCRIPTION')); ?>
 153                  <div class="card">
 154                      <div class="card-body">
 155                          <?php echo $long_description; ?>
 156                      </div>
 157                  </div>
 158              <?php echo HTMLHelper::_('uitab.endTab'); ?>
 159          <?php endif; ?>
 160  
 161          <?php if ($this->item->client_id == 0) : ?>
 162              <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'assignment', Text::_('COM_MODULES_MENU_ASSIGNMENT')); ?>
 163              <fieldset id="fieldset-assignment" class="options-form">
 164                  <legend><?php echo Text::_('COM_MODULES_MENU_ASSIGNMENT'); ?></legend>
 165                  <div>
 166                  <?php echo $this->loadTemplate('assignment'); ?>
 167                  </div>
 168              </fieldset>
 169              <?php echo HTMLHelper::_('uitab.endTab'); ?>
 170          <?php endif; ?>
 171  
 172          <?php
 173          $this->fieldsets        = array();
 174          $this->ignore_fieldsets = array('basic', 'description');
 175          echo LayoutHelper::render('joomla.edit.params', $this);
 176          ?>
 177  
 178          <?php if ($this->canDo->get('core.admin')) : ?>
 179              <?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'permissions', Text::_('COM_MODULES_FIELDSET_RULES')); ?>
 180              <fieldset id="fieldset-permissions" class="options-form">
 181                  <legend><?php echo Text::_('COM_MODULES_FIELDSET_RULES'); ?></legend>
 182                  <div>
 183                  <?php echo $this->form->getInput('rules'); ?>
 184                  </div>
 185              </fieldset>
 186              <?php echo HTMLHelper::_('uitab.endTab'); ?>
 187          <?php endif; ?>
 188  
 189          <?php echo HTMLHelper::_('uitab.endTabSet'); ?>
 190  
 191          <input type="hidden" name="task" value="">
 192          <input type="hidden" name="return" value="<?php echo $input->get('return', null, 'BASE64'); ?>">
 193          <?php echo HTMLHelper::_('form.token'); ?>
 194          <?php echo $this->form->getInput('module'); ?>
 195          <?php echo $this->form->getInput('client_id'); ?>
 196      </div>
 197  </form>


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