diff --git a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php index 3daa81b5f9..f92102d4a2 100644 --- a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php +++ b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php @@ -1207,8 +1207,8 @@ class etemplate_widget_nextmatch_customfilter extends etemplate_widget_transform $this->setElementAttribute($form_name, 'options', trim($this->attrs['widget_options']) != '' ? $this->attrs['widget_options'] : ''); - parent::beforeSendToClient($cname, $expand); $this->setElementAttribute($form_name, 'type', $this->attrs['type']); + parent::beforeSendToClient($cname, $expand); } } diff --git a/etemplate/inc/class.etemplate_widget_transformer.inc.php b/etemplate/inc/class.etemplate_widget_transformer.inc.php index 34ba40bd85..11306dfecf 100644 --- a/etemplate/inc/class.etemplate_widget_transformer.inc.php +++ b/etemplate/inc/class.etemplate_widget_transformer.inc.php @@ -122,6 +122,7 @@ abstract class etemplate_widget_transformer extends etemplate_widget //echo $this; _debug_array($unmodified); _debug_array($attrs); _debug_array(array_diff_assoc($attrs, $unmodified)); // compute the difference and send it to the client as modifications + $type_changed = false; foreach(array_diff_assoc($attrs, $unmodified) as $attr => $val) { switch($attr) @@ -136,6 +137,7 @@ abstract class etemplate_widget_transformer extends etemplate_widget self::$request->sel_options[$form_name] = $val; break; case 'type': // not an attribute in etemplate2 + $type_changed = true; if($val == 'template') { // If the widget has been transformed into a template, we @@ -146,12 +148,22 @@ abstract class etemplate_widget_transformer extends etemplate_widget $this->expand_widget($transformed_template, $expand); $transformed_template->run('beforeSendToClient',array($cname,$expand)); } + $type_changed = false; } default: self::setElementAttribute($form_name, $attr, $val); break; } } + if($type_changed) + { + // Run the new widget type's beforeSendToClient + $expanded_child = self::factory($attrs['type'], false,$this->id); + $expanded_child->id = $this->id; + $expanded_child->type = $attrs['type']; + $expanded_child->attrs = $attrs; + $expanded_child->run('beforeSendToClient',array($cname,$expand)); + } } /** diff --git a/etemplate/js/et2_widget_entry.js b/etemplate/js/et2_widget_entry.js index 3b47587612..26cfbdbecf 100644 --- a/etemplate/js/et2_widget_entry.js +++ b/etemplate/js/et2_widget_entry.js @@ -150,4 +150,4 @@ var et2_entry = et2_valueWidget.extend( } }); -et2_register_widget(et2_entry, ["entry", 'contact-value', 'contact-account', 'contact-template', 'infolog-value','tracker-value']); \ No newline at end of file +et2_register_widget(et2_entry, ["entry", 'contact-value', 'contact-account', 'contact-template', 'infolog-value','tracker-value','records-value']); \ No newline at end of file