- md5
- 84abc17b5b3dd2511a6c09af1ed195c1
- sha1
- 888b4874960cbb00a9ddcffcc1d14e8ea8fd5ce3
- sha256
- 7215c7db3dc395ffbfb0c6699aeaa737ca191109d3c8281d8e353386d4012fc1
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
<?php
/**
* @package Joomla.Plugin
* @subpackage Editors-xtd.readmore
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Plugin\CMSPlugin;
/**
* Editor Readmore button
*
* @since 1.5
*/
class PlgButtonReadmore extends CMSPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* Application object.
*
* @var \Joomla\CMS\Application\CMSApplication
* @since 4.0.0
*/
protected $app;
/**
* Readmore button
*
* @param string $name The name of the button to add
*
* @return CMSObject $button A two element array of (imageName, textToInsert)
*
* @since 1.5
*/
public function onDisplay($name)
{
$doc = $this->app->getDocument();
$doc->getWebAssetManager()
->registerAndUseScript('com_content.admin-article-readmore', 'com_content/admin-article-readmore.min.js', [], ['defer' => true], ['core']);
// Pass some data to javascript
$doc->addScriptOptions(
'xtd-readmore',
array(
'exists' => Text::_('PLG_READMORE_ALREADY_EXISTS', true),
)
);
$button = new CMSObject;
$button->modal = false;
$button->onclick = 'insertReadmore(\'' . $name . '\');return false;';
$button->text = Text::_('PLG_READMORE_BUTTON_READMORE');
$button->name = 'arrow-down';
$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>';
$button->link = '#';
return $button;
}
}
The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.