diff --git a/modules/editor/editor.model.php b/modules/editor/editor.model.php index 9234a1d5c..372c32db2 100644 --- a/modules/editor/editor.model.php +++ b/modules/editor/editor.model.php @@ -751,18 +751,77 @@ class editorModel extends editor } // List extra variables (text type only for editor component) - $extra_vars = $xml_doc->component->extra_vars->var; + $extra_vars = $xml_doc->component->extra_vars; if($extra_vars) { - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); - - foreach($extra_vars as $key => $val) + $extra_var_groups = $extra_vars->group; + if(!$extra_var_groups) { - $key = $val->attrs->name; - $extra_var = new stdClass; - $extra_var->title = $val->title->body; - $extra_var->description = $val->description->body; - $component_info->extra_vars->{$key} = $extra_var; + $extra_var_groups = $extra_vars; + } + if(!is_array($extra_var_groups)) + { + $extra_var_groups = array($extra_var_groups); + } + + foreach($extra_var_groups as $group) + { + $extra_vars = $group->var; + if(!is_array($group->var)) + { + $extra_vars = array($group->var); + } + + foreach($extra_vars as $key => $val) + { + if(!$val) + { + continue; + } + + $obj = new stdClass(); + if(!$val->attrs) + { + $val->attrs = new stdClass(); + } + if(!$val->attrs->type) + { + $val->attrs->type = 'text'; + } + + $obj->group = $group->title->body; + $obj->name = $val->attrs->name; + $obj->title = $val->title->body; + $obj->type = $val->attrs->type; + $obj->description = $val->description->body; + if($obj->name) + { + $obj->value = $extra_vals->{$obj->name}; + } + if(strpos($obj->value, '|@|') != FALSE) + { + $obj->value = explode('|@|', $obj->value); + } + if($obj->type == 'mid_list' && !is_array($obj->value)) + { + $obj->value = array($obj->value); + } + + // 'Select'type obtained from the option list. + if($val->options && !is_array($val->options)) + { + $val->options = array($val->options); + } + + for($i = 0, $c = count($val->options); $i < $c; $i++) + { + $obj->options[$i] = new stdClass(); + $obj->options[$i]->title = $val->options[$i]->title->body; + $obj->options[$i]->value = $val->options[$i]->attrs->value; + } + + $component_info->extra_vars->{$obj->name} = $obj; + } } } diff --git a/modules/editor/tpl/setup_component.html b/modules/editor/tpl/setup_component.html index 9c653a711..897686903 100644 --- a/modules/editor/tpl/setup_component.html +++ b/modules/editor/tpl/setup_component.html @@ -32,13 +32,29 @@ {$component->link} -
- -
- - {$val->description} -
-
+ + + +

{$var->group}

+ {@$group = $var->group} +
+ {@$not_first = true} +
+
+ +
+ + + + {nl2br($var->description)} +
+
+
+
+ +