- md5
- c57391461341826568189733ec3fa169
- sha1
- daf015444f7f729a1c5aa997404a7f86d9ea6874
- sha256
- db10b5e790a75c13e3ecff5d80f132ba91464a45bdf8347f5bca78b91c81af6b
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
<?php
/**
* @package Joomla.Plugin
* @subpackage Editors-xtd.fields
*
* @copyright Copyright (C) 2005 - 2019 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\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Session\Session;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
/**
* 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;
}
// 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.