diff --git a/componentbuilderfieldorderingcompiler.php b/componentbuilderfieldorderingcompiler.php index 4183837..fc12fd3 100644 --- a/componentbuilderfieldorderingcompiler.php +++ b/componentbuilderfieldorderingcompiler.php @@ -20,31 +20,16 @@ use VDM\Joomla\Utilities\ArrayHelper; use VDM\Joomla\Utilities\StringHelper; JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php'); - + +use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory; /** * Extension - Componentbuilder Field Ordering Compiler plugin. * * @package ComponentbuilderFieldOrderingCompiler - * @since 1.0.2 + * @since 1.1.0 */ class PlgExtensionComponentbuilderFieldOrderingCompiler extends CMSPlugin { - /** - * Global switch to see if component have need of field ordering. - * - * @var boolean - * @since 1.0.0 - */ - protected $loadFieldordering = false; - - /** - * The Views active with default ordering options - * - * @var array - * @since 1.0.0 - */ - protected $activeViews = array(); - /** * Event Triggered in the compiler [on Before Model View Data] * @@ -52,7 +37,7 @@ class PlgExtensionComponentbuilderFieldOrderingCompiler extends CMSPlugin * * @since 1.0 */ - public function jcb_ce_onBeforeModelViewData(&$context, &$view, &$placeholders) + public function jcb_ce_onBeforeModelViewData(&$view) { // add the privacy $view->params = (isset($view->params) && JsonHelper::check($view->params)) ? json_decode($view->params, true) : $view->params; @@ -61,31 +46,11 @@ class PlgExtensionComponentbuilderFieldOrderingCompiler extends CMSPlugin if ($view->params['fieldordering']['add_admin_ordering'] == 1 || $view->params['fieldordering']['add_linked_ordering'] == 1) { - // activate the load of the privacy plugin - $this->loadFieldordering = true; // setup the view key name $name_list = StringHelper::safe($view->name_list); // load the admin view details - $this->activeViews[$name_list] = $view->params['fieldordering']; + CFactory::_('Compiler.Builder.Views.Default.Ordering')->set($name_list, $view->params['fieldordering']); } } - } - - /** - * Event Triggered in the compiler [on After Get] - * - * @return void - * - * @since 1.0 - */ - public function jcb_ce_onAfterGet(&$context, $compiler) - { - // check if this component needs a privacy plugin loaded - if ($this->loadFieldordering) - { - // move the data to the compiler - $compiler->viewsDefaultOrdering =& $this->activeViews; - } - } - + } } diff --git a/componentbuilderfieldorderingcompiler.xml b/componentbuilderfieldorderingcompiler.xml index f7f96d5..711aedb 100644 --- a/componentbuilderfieldorderingcompiler.xml +++ b/componentbuilderfieldorderingcompiler.xml @@ -1,13 +1,13 @@ - + PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER - 24th October, 2023 + 2nd March, 2024 Llewellyn van der Merwe joomla@vdm.io https://dev.vdm.io Copyright (C) 2015 Vast Development Method. All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt - 1.0.2 + 1.1.0 PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER_XML_DESCRIPTION diff --git a/language/en-GB/en-GB.plg_extension_componentbuilderfieldorderingcompiler.ini b/language/en-GB/en-GB.plg_extension_componentbuilderfieldorderingcompiler.ini index 3c3588b..9eaa276 100644 --- a/language/en-GB/en-GB.plg_extension_componentbuilderfieldorderingcompiler.ini +++ b/language/en-GB/en-GB.plg_extension_componentbuilderfieldorderingcompiler.ini @@ -1,3 +1,3 @@ PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER="Extension - Componentbuilder Field Ordering Compiler" PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER_DESCRIPTION="This plugin is used to set the ordring for your component views during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to set your admin views where you would like to use Field Ordering." -PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Field Ordering Compiler (v.1.0.2)

This plugin is used to set the ordring for your component views during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to set your admin views where you would like to use Field Ordering.

Created by Llewellyn van der Merwe
Development started 21st May, 2020

" \ No newline at end of file +PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Field Ordering Compiler (v.1.1.0)

This plugin is used to set the ordring for your component views during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to set your admin views where you would like to use Field Ordering.

Created by Llewellyn van der Merwe
Development started 21st May, 2020

" \ No newline at end of file diff --git a/language/en-GB/en-GB.plg_extension_componentbuilderfieldorderingcompiler.sys.ini b/language/en-GB/en-GB.plg_extension_componentbuilderfieldorderingcompiler.sys.ini index 3c3588b..9eaa276 100644 --- a/language/en-GB/en-GB.plg_extension_componentbuilderfieldorderingcompiler.sys.ini +++ b/language/en-GB/en-GB.plg_extension_componentbuilderfieldorderingcompiler.sys.ini @@ -1,3 +1,3 @@ PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER="Extension - Componentbuilder Field Ordering Compiler" PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER_DESCRIPTION="This plugin is used to set the ordring for your component views during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to set your admin views where you would like to use Field Ordering." -PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Field Ordering Compiler (v.1.0.2)

This plugin is used to set the ordring for your component views during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to set your admin views where you would like to use Field Ordering.

Created by Llewellyn van der Merwe
Development started 21st May, 2020

" \ No newline at end of file +PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER_XML_DESCRIPTION="

Extension - Componentbuilder Field Ordering Compiler (v.1.1.0)

This plugin is used to set the ordring for your component views during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to set your admin views where you would like to use Field Ordering.

Created by Llewellyn van der Merwe
Development started 21st May, 2020

" \ No newline at end of file diff --git a/script.php b/script.php index e647f31..24d4062 100644 --- a/script.php +++ b/script.php @@ -12,6 +12,11 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Filesystem\Folder; + /** * Extension - Componentbuilder Field Ordering Compiler script file. * @@ -31,7 +36,7 @@ class plgExtensionComponentbuilderFieldOrderingCompilerInstallerScript public function preflight($route, $adapter) { // get application - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // the default for both install and update $jversion = new JVersion();