nl_tokens: Gets an XTemplate from an object ( an instance of an { @link Ext#define } d class ) . Many times templates are configured high in the class hierarchy and are to be shared by all classes that derive from that base . To further complicate matters these templates are seldom actual instances but are rather configurations . For example :
pl_tokens: function ( instance , name ) { var tpl = instance [ <mask> ] , // go for it! 99% of the time we will get it! owner ; if ( tpl && ! tpl . isTemplate ) { // tpl is just a configuration (not an instance) // create the template instance from the configuration: tpl = Ext . ClassManager . dynInstantiate ( 'Ext.XTemplate' , tpl ) ; // and replace the reference with the new instance: if ( instance . hasOwnProperty ( name ) ) { // the tpl is on the instance owner = instance ; } else { // must be somewhere in the prototype chain for ( owner = instance . self . prototype ; owner && ! owner . hasOwnProperty ( name ) ; owner = owner . superclass ) { } } owner [ name ] = tpl ; tpl . owner = owner ; } // else !tpl (no such tpl) or the tpl is an instance already... either way, tpl // is ready to return return tpl || null ; }