See How to read a template variable from a plugin (PanelCtrl)? for an example of our to get the actual template varialbe