From 9fd59f2353da00f2a599af7a4e1ab842d10221f7 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sat, 7 Jul 2018 00:27:29 +0200 Subject: [PATCH] Added none as the fallback if an editor gets unpublished. --- README.md | 2 +- admin/README.txt | 2 +- admin/helpers/extrusion/a_mapping.php | 3 --- admin/helpers/extrusion/c_extrusion.php | 2 ++ admin/models/admin_view.php | 13 ++++++++++--- admin/models/custom_admin_view.php | 13 ++++++++++--- admin/models/custom_code.php | 13 ++++++++++--- admin/models/dynamic_get.php | 13 ++++++++++--- admin/models/joomla_component.php | 13 ++++++++++--- admin/models/layout.php | 13 ++++++++++--- admin/models/site_view.php | 13 ++++++++++--- admin/models/template.php | 13 ++++++++++--- 12 files changed, 84 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 590df44ec..2e9d36eeb 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo + *Version*: 2.8.2 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **186163** ++ *Line count*: **186219** + *Field count*: **1058** + *File count*: **1238** + *Folder count*: **197** diff --git a/admin/README.txt b/admin/README.txt index 590df44ec..2e9d36eeb 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -129,7 +129,7 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo + *Version*: 2.8.2 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **186163** ++ *Line count*: **186219** + *Field count*: **1058** + *File count*: **1238** + *Folder count*: **197** diff --git a/admin/helpers/extrusion/a_mapping.php b/admin/helpers/extrusion/a_mapping.php index 4305d1bb4..c9908193c 100644 --- a/admin/helpers/extrusion/a_mapping.php +++ b/admin/helpers/extrusion/a_mapping.php @@ -99,9 +99,6 @@ class Mapping */ public function __construct($data = false) { - // set the app to insure messages can be set - $this->app = JFactory::getApplication(); - if (ComponentbuilderHelper::checkArray($data)) { if (isset($data['buildcomp']) && 1 == $data['buildcomp'] && isset($data['buildcompsql'])) diff --git a/admin/helpers/extrusion/c_extrusion.php b/admin/helpers/extrusion/c_extrusion.php index 591537bc5..fc0660fee 100644 --- a/admin/helpers/extrusion/c_extrusion.php +++ b/admin/helpers/extrusion/c_extrusion.php @@ -36,6 +36,8 @@ class Extrusion extends Builder */ public function __construct(&$data) { + // set the app to insure messages can be set + $this->app = JFactory::getApplication(); // make sure we have an id if (isset($data['id']) && $data['id'] > 0) { diff --git a/admin/models/admin_view.php b/admin/models/admin_view.php index f9de74124..63f0fd2a0 100644 --- a/admin/models/admin_view.php +++ b/admin/models/admin_view.php @@ -508,11 +508,18 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin // update all editors to use this components global editor $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); - foreach ($editors as $editor) + // check if we found any + if (ComponentbuilderHelper::checkArray($editors)) { - $name = (string) $editor['name']; - $form->setFieldAttribute($name, 'editor', $global_editor); + foreach ($editors as $editor) + { + // get the field names + $name = (string) $editor['name']; + // set the field editor value (with none as fallback) + $form->setFieldAttribute($name, 'editor', $global_editor . '|none'); + } } return $form; diff --git a/admin/models/custom_admin_view.php b/admin/models/custom_admin_view.php index b81559673..64a725a23 100644 --- a/admin/models/custom_admin_view.php +++ b/admin/models/custom_admin_view.php @@ -329,11 +329,18 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin // update all editors to use this components global editor $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); - foreach ($editors as $editor) + // check if we found any + if (ComponentbuilderHelper::checkArray($editors)) { - $name = (string) $editor['name']; - $form->setFieldAttribute($name, 'editor', $global_editor); + foreach ($editors as $editor) + { + // get the field names + $name = (string) $editor['name']; + // set the field editor value (with none as fallback) + $form->setFieldAttribute($name, 'editor', $global_editor . '|none'); + } } return $form; diff --git a/admin/models/custom_code.php b/admin/models/custom_code.php index 6dd53e337..fdcbaab2f 100644 --- a/admin/models/custom_code.php +++ b/admin/models/custom_code.php @@ -186,11 +186,18 @@ class ComponentbuilderModelCustom_code extends JModelAdmin // update all editors to use this components global editor $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); - foreach ($editors as $editor) + // check if we found any + if (ComponentbuilderHelper::checkArray($editors)) { - $name = (string) $editor['name']; - $form->setFieldAttribute($name, 'editor', $global_editor); + foreach ($editors as $editor) + { + // get the field names + $name = (string) $editor['name']; + // set the field editor value (with none as fallback) + $form->setFieldAttribute($name, 'editor', $global_editor . '|none'); + } } return $form; diff --git a/admin/models/dynamic_get.php b/admin/models/dynamic_get.php index de3c68068..cefcf9b82 100644 --- a/admin/models/dynamic_get.php +++ b/admin/models/dynamic_get.php @@ -336,11 +336,18 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin // update all editors to use this components global editor $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); - foreach ($editors as $editor) + // check if we found any + if (ComponentbuilderHelper::checkArray($editors)) { - $name = (string) $editor['name']; - $form->setFieldAttribute($name, 'editor', $global_editor); + foreach ($editors as $editor) + { + // get the field names + $name = (string) $editor['name']; + // set the field editor value (with none as fallback) + $form->setFieldAttribute($name, 'editor', $global_editor . '|none'); + } } return $form; diff --git a/admin/models/joomla_component.php b/admin/models/joomla_component.php index 876798684..22cb7743c 100644 --- a/admin/models/joomla_component.php +++ b/admin/models/joomla_component.php @@ -364,11 +364,18 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin // update all editors to use this components global editor $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); - foreach ($editors as $editor) + // check if we found any + if (ComponentbuilderHelper::checkArray($editors)) { - $name = (string) $editor['name']; - $form->setFieldAttribute($name, 'editor', $global_editor); + foreach ($editors as $editor) + { + // get the field names + $name = (string) $editor['name']; + // set the field editor value (with none as fallback) + $form->setFieldAttribute($name, 'editor', $global_editor . '|none'); + } } return $form; diff --git a/admin/models/layout.php b/admin/models/layout.php index f8245b135..10657db01 100644 --- a/admin/models/layout.php +++ b/admin/models/layout.php @@ -224,11 +224,18 @@ class ComponentbuilderModelLayout extends JModelAdmin // update all editors to use this components global editor $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); - foreach ($editors as $editor) + // check if we found any + if (ComponentbuilderHelper::checkArray($editors)) { - $name = (string) $editor['name']; - $form->setFieldAttribute($name, 'editor', $global_editor); + foreach ($editors as $editor) + { + // get the field names + $name = (string) $editor['name']; + // set the field editor value (with none as fallback) + $form->setFieldAttribute($name, 'editor', $global_editor . '|none'); + } } return $form; diff --git a/admin/models/site_view.php b/admin/models/site_view.php index d9ecda94a..e31bd79ac 100644 --- a/admin/models/site_view.php +++ b/admin/models/site_view.php @@ -347,11 +347,18 @@ class ComponentbuilderModelSite_view extends JModelAdmin // update all editors to use this components global editor $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); - foreach ($editors as $editor) + // check if we found any + if (ComponentbuilderHelper::checkArray($editors)) { - $name = (string) $editor['name']; - $form->setFieldAttribute($name, 'editor', $global_editor); + foreach ($editors as $editor) + { + // get the field names + $name = (string) $editor['name']; + // set the field editor value (with none as fallback) + $form->setFieldAttribute($name, 'editor', $global_editor . '|none'); + } } return $form; diff --git a/admin/models/template.php b/admin/models/template.php index 3efb9803d..dc630da89 100644 --- a/admin/models/template.php +++ b/admin/models/template.php @@ -224,11 +224,18 @@ class ComponentbuilderModelTemplate extends JModelAdmin // update all editors to use this components global editor $global_editor = JComponentHelper::getParams('com_componentbuilder')->get('editor', 'none'); + // now get all the editor fields $editors = $form->getXml()->xpath("//field[@type='editor']"); - foreach ($editors as $editor) + // check if we found any + if (ComponentbuilderHelper::checkArray($editors)) { - $name = (string) $editor['name']; - $form->setFieldAttribute($name, 'editor', $global_editor); + foreach ($editors as $editor) + { + // get the field names + $name = (string) $editor['name']; + // set the field editor value (with none as fallback) + $form->setFieldAttribute($name, 'editor', $global_editor . '|none'); + } } return $form;