allow to use <widget type="${row}[type]"/> in xet files

This commit is contained in:
Ralf Becker 2013-04-28 12:43:18 +00:00
parent 947511779a
commit 5eede4a8ef

View File

@ -659,6 +659,19 @@ var et2_widget = Class.extend(
// Parse the attributes from the given XML attributes object // Parse the attributes from the given XML attributes object
this.parseXMLAttrs(_node.attributes, attributes, constructor.prototype); this.parseXMLAttrs(_node.attributes, attributes, constructor.prototype);
// check if parseXMLAttrs gives a different type attribute eg. type="@${row}[type]"
if (attributes.type && attributes.type != _nodeName)
{
// set _nodeName and constructor accordingly
_nodeName = attributes.type;
constructor = typeof et2_registry[_nodeName] == "undefined" ?
et2_placeholder : et2_registry[_nodeName];
if (readonly && typeof et2_registry[_nodeName + "_ro"] != "undefined")
{
constructor = et2_registry[_nodeName + "_ro"];
}
}
// Do an sanity check for the attributes // Do an sanity check for the attributes
constructor.prototype.generateAttributeSet(attributes); constructor.prototype.generateAttributeSet(attributes);