halfway fixed eTemplate(1) part of etemplate_widget_transformer, but then enabled old code in contact_widget again, as value is not yet handeled correctly by callback in contact_widget

This commit is contained in:
Ralf Becker 2014-05-07 09:00:59 +00:00
parent 012b49838c
commit 610e7e6e93
2 changed files with 6 additions and 4 deletions

View File

@ -196,8 +196,6 @@ class contact_widget extends etemplate_widget_transformer
* @param etemplate &$tmpl reference to the template we belong too
* @return boolean true if extra label is allowed, false otherwise
*/
/* old code now replaced with etemplate_widget_transformer::pre_process() ...
function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
{
//echo "<p>contact_widget::pre_process('$name','$value',".print_r($cell,true).",...)</p>\n";
@ -277,7 +275,7 @@ class contact_widget extends etemplate_widget_transformer
$cell['id'] = ($cell['id'] ? $cell['id'] : $cell['name'])."[$type]";
return True; // extra label ok
}*/
}
}
// register widgets for etemplate2
etemplate_widget::registerWidget('contact_widget',array('contact-value', 'contact-account', 'contact-template', 'contact-fields'));

View File

@ -78,15 +78,19 @@ abstract class etemplate_widget_transformer extends etemplate_widget
*/
public function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
{
$_value = $value;
$_cell = $cell;
$cell['value'] =& $value;
$cell['options'] =& $cell['size']; // old engine uses 'size' instead of 'options' for legacy options
$cell['id'] =& $cell['name']; // dto for 'name' instead of 'id'
// run the transformation
foreach($this->transformation as $filter => $data)
foreach(static::$transformation as $filter => $data)
{
$this->action($filter, $data, $cell);
}
unset($cell['value']);
error_log(__METHOD__."('$name', ".(is_array($_value)?$_value['id']:$_value).", ".array2string($_cell).", ...) transformed to ".array2string($cell)." and value=".array2string($value));
return true;
}