[ 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.tinymce 6 * 7 * @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Plugin\Editors\TinyMCE\PluginTraits; 12 13 use Joomla\CMS\Language\Text; 14 use Joomla\CMS\Layout\LayoutHelper; 15 use Joomla\CMS\Uri\Uri; 16 use Joomla\Event\Event; 17 18 // phpcs:disable PSR1.Files.SideEffects 19 \defined('_JEXEC') or die; 20 // phpcs:enable PSR1.Files.SideEffects 21 22 /** 23 * Resolves the XTD Buttons for the current TinyMCE editor. 24 * 25 * @since 4.1.0 26 */ 27 trait XTDButtons 28 { 29 /** 30 * Get the XTD buttons and render them inside tinyMCE 31 * 32 * @param string $name the id of the editor field 33 * @param string $excluded the buttons that should be hidden 34 * 35 * @return array|void 36 * 37 * @since 4.1.0 38 */ 39 private function tinyButtons($name, $excluded) 40 { 41 // Get the available buttons 42 $buttonsEvent = new Event( 43 'getButtons', 44 [ 45 'editor' => $name, 46 'buttons' => $excluded, 47 ] 48 ); 49 50 $buttonsResult = $this->getDispatcher()->dispatch('getButtons', $buttonsEvent); 51 $buttons = $buttonsResult['result']; 52 53 if (is_array($buttons) || (is_bool($buttons) && $buttons)) { 54 Text::script('PLG_TINY_CORE_BUTTONS'); 55 56 // Init the arrays for the buttons 57 $btnsNames = []; 58 59 // Build the script 60 foreach ($buttons as $i => $button) { 61 $button->id = $name . '_' . $button->name . '_modal'; 62 63 echo LayoutHelper::render('joomla.editors.buttons.modal', $button); 64 65 if ($button->get('name')) { 66 $coreButton = []; 67 $coreButton['name'] = $button->get('text'); 68 $coreButton['href'] = $button->get('link') !== '#' ? Uri::base() . $button->get('link') : null; 69 $coreButton['id'] = $name . '_' . $button->name; 70 $coreButton['icon'] = $button->get('icon'); 71 $coreButton['click'] = $button->get('onclick') ?: null; 72 $coreButton['iconSVG'] = $button->get('iconSVG'); 73 74 // The array with the toolbar buttons 75 $btnsNames[] = $coreButton; 76 } 77 } 78 79 sort($btnsNames); 80 81 return ['names' => $btnsNames]; 82 } 83 } 84 }
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 |