- md5
- 7edbf8fa89ad9f26639b5a1eee75e9a0
- sha1
- f3a20c21691a7382dbb871a314f4be015509b62a
- sha256
- b0640c41d004fc565d346908ff01f0db9f5989c5e3e0cf0997cce28c9691f849
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
<?php
/**
* @package Joomla.Plugin
* @subpackage Editors.tinymce
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Form Field class for the TinyMCE editor.
*
* @package Joomla.Plugin
* @subpackage Editors.tinymce
* @since 3.7.0
*/
class JFormFieldTinymceBuilder extends JFormField
{
/**
* The form field type.
*
* @var string
* @since 3.7.0
*/
protected $type = 'tinymcebuilder';
/**
* Name of the layout being used to render the field
*
* @var string
* @since 3.7.0
*/
protected $layout = 'plugins.editors.tinymce.field.tinymcebuilder';
/**
* Method to get the data to be passed to the layout for rendering.
*
* @return array
*
* @since 3.7.0
*/
protected function getLayoutData()
{
$data = parent::getLayoutData();
$valueAll = (object) $this->form->getValue('params');
$setsAmount = empty($valueAll->sets_amount) ? 3 : $valueAll->sets_amount;
// Get the plugin
require_once JPATH_PLUGINS . '/editors/tinymce/tinymce.php';
$menus = array(
'edit' => array('label' => 'Edit'),
'insert' => array('label' => 'Insert'),
'view' => array('label' => 'View'),
'format' => array('label' => 'Format'),
'table' => array('label' => 'Table'),
'tools' => array('label' => 'Tools'),
);
$data['menus'] = $menus;
$data['menubarSource'] = array_keys($menus);
$data['buttons'] = PlgEditorTinymce::getKnownButtons();
$data['buttonsSource'] = array_keys($data['buttons']);
$data['toolbarPreset'] = PlgEditorTinymce::getToolbarPreset();
$data['setsAmount'] = $setsAmount;
// Get array of sets names
for ($i = 0; $i < $setsAmount; $i++)
{
$data['setsNames'][$i] = JText::sprintf('PLG_TINY_SET_TITLE', $i);
}
krsort($data['setsNames']);
// Prepare the forms for each set
$setsForms = array();
$formsource = JPATH_PLUGINS . '/editors/tinymce/form/setoptions.xml';
// Check the old values for B/C
$valueOld = new stdClass;
if ($this->value && empty($this->value['setoptions']))
{
$valueOld = $valueAll;
}
foreach (array_keys($data['setsNames']) as $num)
{
$formname = 'set.form.' . $num;
$control = $this->name . '[setoptions][' . $num . ']';
$setsForms[$num] = JForm::getInstance($formname, $formsource, array('control' => $control));
// Bind the values
if (empty($this->value['setoptions'][$num]))
{
$formValues = $valueOld;
// Predefine access: 0 for special, 1 for registered, all else is public
$formValues->access = !$num ? 3 : ($num === 1 ? 2 : 1);
}
else
{
$formValues = $this->value['setoptions'][$num];
}
$setsForms[$num]->bind($formValues);
}
$data['setsForms'] = $setsForms;
return $data;
}
}
No other release has this exact content. See every version of this file.