From e9582200ffe53875a5bc50b6c93f066bc175b89b Mon Sep 17 00:00:00 2001 From: aB0t Date: Wed, 18 Oct 2023 09:28:04 +0200 Subject: [PATCH] Update on v1.0.2 (beta for next version) Here's an update on the current version, which includes changes towards the next release still in beta. --- componentbuilderfieldorderingtabs.xml | 2 +- fields/adminlistvieworderfields.php | 13 +++++++++++-- fields/linkedviewsorderfields.php | 13 +++++++++++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/componentbuilderfieldorderingtabs.xml b/componentbuilderfieldorderingtabs.xml index 8a1c751..2d837dd 100644 --- a/componentbuilderfieldorderingtabs.xml +++ b/componentbuilderfieldorderingtabs.xml @@ -1,7 +1,7 @@ PLG_CONTENT_COMPONENTBUILDERFIELDORDERINGTABS - 2nd May, 2023 + 18th October, 2023 Llewellyn van der Merwe joomla@vdm.io https://dev.vdm.io diff --git a/fields/adminlistvieworderfields.php b/fields/adminlistvieworderfields.php index c8618cd..8dc7f43 100644 --- a/fields/adminlistvieworderfields.php +++ b/fields/adminlistvieworderfields.php @@ -120,8 +120,17 @@ class JFormFieldAdminlistvieworderfields extends JFormFieldList foreach($items as $item) { // get the field name (TODO this could slow down the system so we will need to improve on this) - $field_name = ComponentbuilderHelper::safeFieldName(ComponentbuilderHelper::getBetween(json_decode($item->xml),'name="','"')); - $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]'); + if (isset($item->xml) && ComponentbuilderHelper::checkJson($item->xml)) + { + $field_xml = json_decode($item->xml); + $field_name = ComponentbuilderHelper::getBetween($field_xml,'name="','"'); + $field_name = ComponentbuilderHelper::safeFieldName($field_name); + $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]'); + } + else + { + $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ empty - ' . $item->type . ' ]'); + } } } return $options; diff --git a/fields/linkedviewsorderfields.php b/fields/linkedviewsorderfields.php index 7cfaaa5..c4281ad 100644 --- a/fields/linkedviewsorderfields.php +++ b/fields/linkedviewsorderfields.php @@ -87,8 +87,17 @@ class JFormFieldLinkedviewsorderfields extends JFormFieldList foreach($items as $item) { // get the field name (TODO this could slow down the system so we will need to improve on this) - $field_name = ComponentbuilderHelper::safeFieldName(ComponentbuilderHelper::getBetween(json_decode($item->xml),'name="','"')); - $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]'); + if (isset($item->xml) && ComponentbuilderHelper::checkJson($item->xml)) + { + $field_xml = json_decode($item->xml); + $field_name = ComponentbuilderHelper::getBetween($field_xml,'name="','"'); + $field_name = ComponentbuilderHelper::safeFieldName($field_name); + $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ ' . $field_name . ' - ' . $item->type . ' ]'); + } + else + { + $options[] = JHtml::_('select.option', $item->id, $item->name . ' [ empty - ' . $item->type . ' ]'); + } } } return $options;