[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Plugin 5 * @subpackage Editors-xtd.module 6 * 7 * @copyright (C) 2015 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 Module button 25 * 26 * @since 3.5 27 */ 28 class PlgButtonModule extends CMSPlugin 29 { 30 /** 31 * Load the language file on instantiation. 32 * 33 * @var boolean 34 * @since 3.5 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.5 46 */ 47 public function onDisplay($name) 48 { 49 /* 50 * Use the built-in element view to select the module. 51 * Currently uses blank class. 52 */ 53 $user = Factory::getUser(); 54 55 if ( 56 $user->authorise('core.create', 'com_modules') 57 || $user->authorise('core.edit', 'com_modules') 58 || $user->authorise('core.edit.own', 'com_modules') 59 ) { 60 $link = 'index.php?option=com_modules&view=modules&layout=modal&tmpl=component&editor=' 61 . $name . '&' . Session::getFormToken() . '=1'; 62 $button = new CMSObject(); 63 $button->modal = true; 64 $button->link = $link; 65 $button->text = Text::_('PLG_MODULE_BUTTON_MODULE'); 66 $button->name = $this->_type . '_' . $this->_name; 67 $button->icon = 'cube'; 68 $button->iconSVG = '<svg viewBox="0 0 512 512" width="24" height="24"><path d="M239.1 6.3l-208 78c-18.7 7-31.1 ' 69 . '25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 ' 70 . '26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 ' 71 . '78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z"></path></svg>'; 72 $button->options = [ 73 'height' => '300px', 74 'width' => '800px', 75 'bodyHeight' => '70', 76 'modalWidth' => '80', 77 ]; 78 79 return $button; 80 } 81 } 82 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |