Resolve gh-609 to make sure that custom code set in a field that gets linked to a module will get added to the module.
This commit is contained in:
@ -3986,8 +3986,6 @@ class Get
|
||||
$this->_fieldData[$id]->css_view_decoded = true;
|
||||
}
|
||||
}
|
||||
// add this only once to view.
|
||||
$this->customFieldScript[$name_single][$id] = true;
|
||||
}
|
||||
// check if we should load scripts for list views
|
||||
if (ComponentbuilderHelper::checkString($name_list)
|
||||
@ -4058,7 +4056,7 @@ class Get
|
||||
$this->setCustomScriptBuilder(
|
||||
$this->_fieldData[$id]->css_views,
|
||||
'css_views',
|
||||
$name_list,
|
||||
$name_single,
|
||||
false,
|
||||
array('prefix' => PHP_EOL),
|
||||
$convert__,
|
||||
@ -4070,10 +4068,11 @@ class Get
|
||||
$this->_fieldData[$id]->css_views_decoded = true;
|
||||
}
|
||||
}
|
||||
|
||||
// add this only once to view.
|
||||
$this->customFieldScript[$name_list][$id] = true;
|
||||
}
|
||||
// add this only once to single view.
|
||||
$this->customFieldScript[$name_single][$id] = true;
|
||||
// add this only once to list view.
|
||||
$this->customFieldScript[$name_list][$id] = true;
|
||||
}
|
||||
if ($id > 0 && isset($this->_fieldData[$id]))
|
||||
{
|
||||
@ -5235,6 +5234,57 @@ class Get
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the a script from the custom script builder
|
||||
*
|
||||
* @param string $first The first key
|
||||
* @param string $second The second key
|
||||
* @param string $prefix The prefix to add in front of the script if found
|
||||
* @param string $note The switch/note to add to the script
|
||||
* @param bool $unset The switch to unset the value if found
|
||||
* @param string $default The switch/string to use as default return if script not found
|
||||
* @param string $sufix The sufix to add after the script if found
|
||||
*
|
||||
* @return mix The string/script if found or the default value if not found
|
||||
*
|
||||
*/
|
||||
public function getCustomScriptBuilder($first, $second, $prefix = '',
|
||||
$note = null, $unset = null, $default = null, $sufix = ''
|
||||
) {
|
||||
// default is to return an empty string
|
||||
$script = '';
|
||||
// check if there is any custom script
|
||||
if (isset($this->customScriptBuilder[$first][$second])
|
||||
&& ComponentbuilderHelper::checkString(
|
||||
$this->customScriptBuilder[$first][$second]
|
||||
))
|
||||
{
|
||||
// add not if set
|
||||
if ($note)
|
||||
{
|
||||
$script .= $note;
|
||||
}
|
||||
// load the actual script
|
||||
$script .= $prefix . str_replace(
|
||||
array_keys($this->placeholders),
|
||||
array_values($this->placeholders),
|
||||
$this->customScriptBuilder[$first][$second]
|
||||
) . $sufix;
|
||||
// clear some memory
|
||||
if ($unset)
|
||||
{
|
||||
unset($this->customScriptBuilder[$first][$second]);
|
||||
}
|
||||
}
|
||||
// if not found return default
|
||||
if (!ComponentbuilderHelper::checkString($script) && $default)
|
||||
{
|
||||
return $default;
|
||||
}
|
||||
|
||||
return $script;
|
||||
}
|
||||
|
||||
/**
|
||||
* To limit the SQL Demo date build in the views
|
||||
*
|
||||
@ -8699,7 +8749,7 @@ class Get
|
||||
$unique = $form['fields_name']
|
||||
. $form['fieldset'];
|
||||
}
|
||||
// set global fields rule path switchs
|
||||
// set global fields rule path switches
|
||||
if ($module->fields_rules_paths == 1
|
||||
&& isset($form['fields_rules_paths'])
|
||||
&& $form['fields_rules_paths'] == 2)
|
||||
@ -9095,6 +9145,39 @@ class Get
|
||||
return $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the module admin custom script field
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function getModAdminVvvvvvvdm($fieldScriptBucket)
|
||||
{
|
||||
$form_field_class = array();
|
||||
$form_field_class[] = $this->hhh . 'BOM' . $this->hhh . PHP_EOL;
|
||||
$form_field_class[] = "//" . $this->setLine(__LINE__) . " No direct access to this file";
|
||||
$form_field_class[] = "defined('_JEXEC') or die('Restricted access');";
|
||||
$form_field_class[] = PHP_EOL . "use Joomla\CMS\Form\FormField;";
|
||||
$form_field_class[] = "use Joomla\CMS\Factory;";
|
||||
$form_field_class[] = PHP_EOL . "class JFormFieldModadminvvvvvvvdm extends FormField";
|
||||
$form_field_class[] = "{";
|
||||
$form_field_class[] = $this->_t(1) . "protected \$type = 'modadminvvvvvvvdm';";
|
||||
$form_field_class[] = PHP_EOL . $this->_t(1) . "protected function getLabel()";
|
||||
$form_field_class[] = $this->_t(1) . "{";
|
||||
$form_field_class[] = $this->_t(2) . "return;";
|
||||
$form_field_class[] = $this->_t(1) . "}";
|
||||
$form_field_class[] = PHP_EOL . $this->_t(1) . "protected function getInput()";
|
||||
$form_field_class[] = $this->_t(1) . "{";
|
||||
$form_field_class[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Get the document";
|
||||
$form_field_class[] = $this->_t(2) . "\$document = Factory::getDocument();";
|
||||
$form_field_class[] = implode(PHP_EOL, $fieldScriptBucket);
|
||||
$form_field_class[] = $this->_t(2) . "return; // noting for now :)";
|
||||
$form_field_class[] = $this->_t(1) . "}";
|
||||
$form_field_class[] = "}";
|
||||
|
||||
return implode(PHP_EOL, $form_field_class);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the Joomla plugins IDs
|
||||
*
|
||||
|
Reference in New Issue
Block a user