[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/plugins/editors-xtd/menu/ -> menu.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Plugin
   5   * @subpackage  Editors-xtd.menu
   6   *
   7   * @copyright   (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9  
  10   * @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
  11   */
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\Language\Text;
  15  use Joomla\CMS\Object\CMSObject;
  16  use Joomla\CMS\Plugin\CMSPlugin;
  17  use Joomla\CMS\Session\Session;
  18  
  19  // phpcs:disable PSR1.Files.SideEffects
  20  \defined('_JEXEC') or die;
  21  // phpcs:enable PSR1.Files.SideEffects
  22  
  23  /**
  24   * Editor menu button
  25   *
  26   * @since  3.7.0
  27   */
  28  class PlgButtonMenu extends CMSPlugin
  29  {
  30      /**
  31       * Load the language file on instantiation.
  32       *
  33       * @var    boolean
  34       * @since  3.7.0
  35       */
  36      protected $autoloadLanguage = true;
  37  
  38      /**
  39       * Display the button
  40       *
  41       * @param   string  $name  The name of the button to add
  42       *
  43       * @since  3.7.0
  44       * @return CMSObject
  45       */
  46      public function onDisplay($name)
  47      {
  48          /*
  49           * Use the built-in element view to select the menu item.
  50           * Currently uses blank class.
  51           */
  52          $user  = Factory::getUser();
  53  
  54          if (
  55              $user->authorise('core.create', 'com_menus')
  56              || $user->authorise('core.edit', 'com_menus')
  57          ) {
  58              $link = 'index.php?option=com_menus&amp;view=items&amp;layout=modal&amp;tmpl=component&amp;'
  59              . Session::getFormToken() . '=1&amp;editor=' . $name;
  60  
  61              $button = new CMSObject();
  62              $button->modal   = true;
  63              $button->link    = $link;
  64              $button->text    = Text::_('PLG_EDITORS-XTD_MENU_BUTTON_MENU');
  65              $button->name    = $this->_type . '_' . $this->_name;
  66              $button->icon    = 'list';
  67              $button->iconSVG = '<svg viewBox="0 0 512 512"  width="24" height="24"><path d="M80 368H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 1'
  68                              . '6 0 0 0 16-16v-64a16 16 0 0 0-16-16zm0-320H16A16 16 0 0 0 0 64v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16V64a16 16 '
  69                              . '0 0 0-16-16zm0 160H16a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h64a16 16 0 0 0 16-16v-64a16 16 0 0 0-16-16zm416 176H1'
  70                              . '76a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm0-320H176a16 16 0 0 0-16 16'
  71                              . 'v32a16 16 0 0 0 16 16h320a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16zm0 160H176a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16'
  72                              . 'h320a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16z"></path></svg>';
  73  
  74              $button->options = [
  75              'height'      => '300px',
  76              'width'       => '800px',
  77              'bodyHeight'  => '70',
  78              'modalWidth'  => '80',
  79              ];
  80  
  81              return $button;
  82          }
  83      }
  84  }


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