Action: load_template
Method in template.js (Attention, will be replaced in the future with the load_template method from WRtemplateObject.js)
WRtemplateObject:load_template:
Stores the current loaded template and prepares the submitted data for the get_template Action.
The prepared data contains a nonce, the name of the action (get_template) and the payload from the calling element (mostly defined in the onclick attribute of an HTML Element) .
The payload and the current Get Params were also stored with the currentTemplate.
The action will be triggered with the proccess_data function with the parameters WRtemplateObject:show_template function as callback and data.
show_template will replace the returned template from the server with the previous stored currentTemplate. Then it will scroll to a defined Element or to the top of the window.
At the end the method will trigger the event wr_afterShowTemplate, which allows external Plugins to work with s the new loaded Template.
Params:
One JSON Object can be used as parameter for the load_template method.
The following properties are allowed:
- template: the identifier for the template which should be loaded
- ancestor: TODO
- scrollToElement: a JSON Object like {id:”anchor-element”, offset:”-150″}, the id is mandatory, offset is optional
- any value you want, e.g. you need a dynamic value which will be only available after the html is rendered, like the id of the displayed entry. To accomplish this you can just add the property id:’##id##’.