Added none as the fallback if an editor gets unpublished.

This commit is contained in:
2018-07-07 00:27:29 +02:00
parent 2b39af94a2
commit 9fd59f2353
12 changed files with 84 additions and 29 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;