2022-01-10 14:11:20 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
|
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
2022-08-20 16:38:51 +00:00
|
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
2022-01-10 14:11:20 +00:00
|
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
|
|
|
use Joomla\CMS\Form\Form;
|
|
|
|
use Joomla\CMS\Plugin\CMSPlugin;
|
|
|
|
|
|
|
|
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Content - Componentbuilder Dynamic Get Headers Tabs plugin.
|
|
|
|
*
|
|
|
|
* @package ComponentbuilderDynamicGetHeadersTabs
|
2023-02-05 21:57:58 +00:00
|
|
|
* @since 2.0.2
|
2022-01-10 14:11:20 +00:00
|
|
|
*/
|
|
|
|
class PlgContentComponentbuilderDynamicGetHeadersTabs extends CMSPlugin
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Affects constructor behavior. If true, language files will be loaded automatically.
|
|
|
|
*
|
|
|
|
* @var boolean
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
|
|
|
protected $autoloadLanguage = true;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Runs on content preparation of form.
|
|
|
|
*
|
|
|
|
* @param JForm $form The form
|
|
|
|
* @param stdClass $data The data
|
|
|
|
*
|
|
|
|
* @return boolean
|
|
|
|
*
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
|
|
|
public function onContentPrepareForm(Form $form, $data)
|
|
|
|
{
|
|
|
|
$context = $form->getName();
|
|
|
|
|
|
|
|
// When this is componentbuilder dynamic_get
|
|
|
|
if (strpos($context, 'com_componentbuilder.dynamic_get') === 0)
|
|
|
|
{
|
|
|
|
// Add the forms path
|
|
|
|
Form::addFormPath(__DIR__ . '/forms');
|
|
|
|
// add the admin view params for privacy integration
|
|
|
|
$form->loadFile('dynamic_get');
|
|
|
|
// update all editors to use this components global editor
|
|
|
|
$global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none');
|
|
|
|
// set the field editor value (with none as fallback)
|
|
|
|
$editors = $form->getXml()->xpath('descendant::fields[@name="dynamic_get_headers"]//field[@type="editor"]');
|
|
|
|
// check if we found any
|
|
|
|
if (ComponentbuilderHelper::checkArray($editors))
|
|
|
|
{
|
|
|
|
foreach ($editors as $editor)
|
|
|
|
{
|
|
|
|
// set the editor to the global option
|
|
|
|
$editor['editor'] = $global_editor . '|none';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|