- md5
- 1e3bc09e64a48627a083f48ad0e66895
- sha1
- 21fda6e99bb847764e918a44d9826f2c2053c54e
- sha256
- 01cb18a81bdc1719910954c8173a92159aa191fe79b589ef07b39a6db261dbb1
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
<?php
/**
* @package Joomla.Plugin
* @subpackage Editors-xtd.fields
*
* @copyright Copyright (C) 2005 - 2018 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\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Component\ComponentHelper;
/**
* Editor Fields button
*
* @since 3.7.0
*/
class PlgButtonFields extends CMSPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.7.0
*/
protected $autoloadLanguage = true;
/**
* Display the button
*
* @param string $name The name of the button to add
*
* @return CMSObject The button options as JObject
*
* @since 3.7.0
*/
public function onDisplay($name)
{
// Check if com_fields is enabled
if (!ComponentHelper::isEnabled('com_fields'))
{
return;
}
// Register FieldsHelper
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
// Guess the field context based on view.
$jinput = Factory::getApplication()->input;
$context = $jinput->get('option') . '.' . $jinput->get('view');
// Validate context.
$context = implode('.', FieldsHelper::extract($context));
if (!FieldsHelper::getFields($context))
{
return;
}
$link = 'index.php?option=com_fields&view=fields&layout=modal&tmpl=component&context='
. $context . '&editor=' . $name . '&' . Session::getFormToken() . '=1';
$button = new CMSObject;
$button->modal = true;
$button->link = $link;
$button->text = Text::_('PLG_EDITORS-XTD_FIELDS_BUTTON_FIELD');
$button->name = 'puzzle';
$button->options = [
'height' => '300px',
'width' => '800px',
'bodyHeight' => '70',
'modalWidth' => '80',
];
return $button;
}
}
No other release has this exact content. See every version of this file.