[ 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.readmore 6 * 7 * @copyright (C) 2006 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\Language\Text; 14 use Joomla\CMS\Object\CMSObject; 15 use Joomla\CMS\Plugin\CMSPlugin; 16 17 // phpcs:disable PSR1.Files.SideEffects 18 \defined('_JEXEC') or die; 19 // phpcs:enable PSR1.Files.SideEffects 20 21 /** 22 * Editor Readmore button 23 * 24 * @since 1.5 25 */ 26 class PlgButtonReadmore extends CMSPlugin 27 { 28 /** 29 * Load the language file on instantiation. 30 * 31 * @var boolean 32 * @since 3.1 33 */ 34 protected $autoloadLanguage = true; 35 36 /** 37 * Application object. 38 * 39 * @var \Joomla\CMS\Application\CMSApplication 40 * @since 4.0.0 41 */ 42 protected $app; 43 44 /** 45 * Readmore button 46 * 47 * @param string $name The name of the button to add 48 * 49 * @return CMSObject $button A two element array of (imageName, textToInsert) 50 * 51 * @since 1.5 52 */ 53 public function onDisplay($name) 54 { 55 $doc = $this->app->getDocument(); 56 $doc->getWebAssetManager() 57 ->registerAndUseScript('com_content.admin-article-readmore', 'com_content/admin-article-readmore.min.js', [], ['defer' => true], ['core']); 58 59 // Pass some data to javascript 60 $doc->addScriptOptions( 61 'xtd-readmore', 62 array( 63 'exists' => Text::_('PLG_READMORE_ALREADY_EXISTS', true), 64 ) 65 ); 66 67 $button = new CMSObject(); 68 $button->modal = false; 69 $button->onclick = 'insertReadmore(\'' . $name . '\');return false;'; 70 $button->text = Text::_('PLG_READMORE_BUTTON_READMORE'); 71 $button->name = $this->_type . '_' . $this->_name; 72 $button->icon = 'arrow-down'; 73 $button->iconSVG = '<svg viewBox="0 0 32 32" width="24" height="24"><path d="M32 12l-6-6-10 10-10-10-6 6 16 16z"></path></svg>'; 74 $button->link = '#'; 75 76 return $button; 77 } 78 }
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 |