[ 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.fields 6 * 7 * @copyright (C) 2017 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\Component\ComponentHelper; 14 use Joomla\CMS\Factory; 15 use Joomla\CMS\Language\Text; 16 use Joomla\CMS\Object\CMSObject; 17 use Joomla\CMS\Plugin\CMSPlugin; 18 use Joomla\CMS\Session\Session; 19 20 // phpcs:disable PSR1.Files.SideEffects 21 \defined('_JEXEC') or die; 22 // phpcs:enable PSR1.Files.SideEffects 23 24 /** 25 * Editor Fields button 26 * 27 * @since 3.7.0 28 */ 29 class PlgButtonFields extends CMSPlugin 30 { 31 /** 32 * Load the language file on instantiation. 33 * 34 * @var boolean 35 * @since 3.7.0 36 */ 37 protected $autoloadLanguage = true; 38 39 /** 40 * Display the button 41 * 42 * @param string $name The name of the button to add 43 * 44 * @return CMSObject|void The button options as CMSObject 45 * 46 * @since 3.7.0 47 */ 48 public function onDisplay($name) 49 { 50 // Check if com_fields is enabled 51 if (!ComponentHelper::isEnabled('com_fields')) { 52 return; 53 } 54 55 // Guess the field context based on view. 56 $jinput = Factory::getApplication()->input; 57 $context = $jinput->get('option') . '.' . $jinput->get('view'); 58 59 // Special context for com_categories 60 if ($context === 'com_categories.category') { 61 $context = $jinput->get('extension', 'com_content') . '.categories'; 62 } 63 64 $link = 'index.php?option=com_fields&view=fields&layout=modal&tmpl=component&context=' 65 . $context . '&editor=' . $name . '&' . Session::getFormToken() . '=1'; 66 67 $button = new CMSObject(); 68 $button->modal = true; 69 $button->link = $link; 70 $button->text = Text::_('PLG_EDITORS-XTD_FIELDS_BUTTON_FIELD'); 71 $button->name = $this->_type . '_' . $this->_name; 72 $button->icon = 'puzzle'; 73 $button->iconSVG = '<svg viewBox="0 0 576 512" width="24" height="24"><path d="M519.442 288.651c-41.519 0-59.5 31.593-82.058 31.593C377.' 74 . '409 320.244 432 144 432 144s-196.288 80-196.288-3.297c0-35.827 36.288-46.25 36.288-85.985C272 19.216 243.885 0 210.' 75 . '539 0c-34.654 0-66.366 18.891-66.366 56.346 0 41.364 31.711 59.277 31.711 81.75C175.885 207.719 0 166.758 0 166.758' 76 . 'v333.237s178.635 41.047 178.635-28.662c0-22.473-40-40.107-40-81.471 0-37.456 29.25-56.346 63.577-56.346 33.673 0 61' 77 . '.788 19.216 61.788 54.717 0 39.735-36.288 50.158-36.288 85.985 0 60.803 129.675 25.73 181.23 25.73 0 0-34.725-120.1' 78 . '01 25.827-120.101 35.962 0 46.423 36.152 86.308 36.152C556.712 416 576 387.99 576 354.443c0-34.199-18.962-65.792-56' 79 . '.558-65.792z"></path></svg>'; 80 $button->options = [ 81 'height' => '300px', 82 'width' => '800px', 83 'bodyHeight' => '70', 84 'modalWidth' => '80', 85 ]; 86 87 return $button; 88 } 89 }
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 |