[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Plugin
   5   * @subpackage  Editors-xtd.contact
   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 Contact button
  25   *
  26   * @since  3.7.0
  27   */
  28  class PlgButtonContact 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       * @return  CMSObject|void  The button options as CMSObject
  44       *
  45       * @since   3.7.0
  46       */
  47      public function onDisplay($name)
  48      {
  49          $user  = Factory::getUser();
  50  
  51          if (
  52              $user->authorise('core.create', 'com_contact')
  53              || $user->authorise('core.edit', 'com_contact')
  54              || $user->authorise('core.edit.own', 'com_contact')
  55          ) {
  56              // The URL for the contacts list
  57              $link = 'index.php?option=com_contact&amp;view=contacts&amp;layout=modal&amp;tmpl=component&amp;'
  58                  . Session::getFormToken() . '=1&amp;editor=' . $name;
  59  
  60              $button = new CMSObject();
  61              $button->modal   = true;
  62              $button->link    = $link;
  63              $button->text    = Text::_('PLG_EDITORS-XTD_CONTACT_BUTTON_CONTACT');
  64              $button->name    = $this->_type . '_' . $this->_name;
  65              $button->icon    = 'address';
  66              $button->iconSVG = '<svg viewBox="0 0 448 512" width="24" height="24"><path d="M436 160c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20V48c'
  67                              . '0-26.5-21.5-48-48-48H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h320c26.5 0 48-21.5 48-48v-48h20c6.6 0 12-5.4 1'
  68                              . '2-12v-40c0-6.6-5.4-12-12-12h-20v-64h20c6.6 0 12-5.4 12-12v-40c0-6.6-5.4-12-12-12h-20v-64h20zm-228-32c35.3 0 64 28.7'
  69                              . ' 64 64s-28.7 64-64 64-64-28.7-64-64 28.7-64 64-64zm112 236.8c0 10.6-10 19.2-22.4 19.2H118.4C106 384 96 375.4 96 364.'
  70                              . '8v-19.2c0-31.8 30.1-57.6 67.2-57.6h5c12.3 5.1 25.7 8 39.8 8s27.6-2.9 39.8-8h5c37.1 0 67.2 25.8 67.2 57.6v19.2z">'
  71                              . '</path></svg>';
  72  
  73              $button->options = [
  74              'height' => '300px',
  75              'width'  => '800px',
  76              'bodyHeight'  => '70',
  77              'modalWidth'  => '80',
  78              ];
  79  
  80              return $button;
  81          }
  82      }
  83  }


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