2021-10-14 14:31:37 +00:00
|
|
|
<?php
|
2021-12-16 13:15:32 +00:00
|
|
|
/**
|
|
|
|
* @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>
|
2021-12-16 13:15:32 +00:00
|
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
2021-10-14 14:31:37 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
|
|
|
use Joomla\CMS\Application\CMSApplication;
|
|
|
|
use Joomla\CMS\Plugin\CMSPlugin;
|
2023-10-18 07:28:04 +00:00
|
|
|
use Joomla\Registry\Registry;
|
|
|
|
use VDM\Joomla\Utilities\JsonHelper;
|
|
|
|
use VDM\Joomla\Utilities\ArrayHelper;
|
2024-03-11 16:37:08 +00:00
|
|
|
use VDM\Joomla\Utilities\StringHelper;
|
|
|
|
use VDM\Joomla\Componentbuilder\Compiler\Factory;
|
2021-10-14 14:31:37 +00:00
|
|
|
/**
|
|
|
|
* Extension - Componentbuilder Field Ordering Compiler plugin.
|
|
|
|
*
|
|
|
|
* @package ComponentbuilderFieldOrderingCompiler
|
2024-03-11 16:37:08 +00:00
|
|
|
* @since 2.0.0
|
2021-10-14 14:31:37 +00:00
|
|
|
*/
|
|
|
|
class PlgExtensionComponentbuilderFieldOrderingCompiler extends CMSPlugin
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Event Triggered in the compiler [on Before Model View Data]
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2024-03-02 20:10:30 +00:00
|
|
|
public function jcb_ce_onBeforeModelViewData(&$view)
|
2021-10-14 14:31:37 +00:00
|
|
|
{
|
|
|
|
// add the privacy
|
2023-10-18 07:28:04 +00:00
|
|
|
$view->params = (isset($view->params) && JsonHelper::check($view->params)) ? json_decode($view->params, true) : $view->params;
|
|
|
|
if (ArrayHelper::check($view->params) && isset($view->params['fieldordering']) && ArrayHelper::check($view->params['fieldordering']))
|
2021-10-14 14:31:37 +00:00
|
|
|
{
|
|
|
|
if ($view->params['fieldordering']['add_admin_ordering'] == 1
|
|
|
|
|| $view->params['fieldordering']['add_linked_ordering'] == 1)
|
|
|
|
{
|
|
|
|
// setup the view key name
|
2023-10-18 07:28:04 +00:00
|
|
|
$name_list = StringHelper::safe($view->name_list);
|
2021-10-14 14:31:37 +00:00
|
|
|
// load the admin view details
|
2024-03-11 16:37:08 +00:00
|
|
|
Factory::_('Compiler.Builder.Views.Default.Ordering')->set($name_list, $view->params['fieldordering']);
|
2021-10-14 14:31:37 +00:00
|
|
|
}
|
|
|
|
}
|
2024-03-02 20:10:30 +00:00
|
|
|
}
|
2021-10-14 14:31:37 +00:00
|
|
|
}
|