Keyword

K2 plugin accessing the data in a template

  • Alan Sparkes
  • Alan Sparkes's Avatar Topic Author
  • Offline
  • Premium Member
More
14 years 5 months ago #85075 by Alan Sparkes
K2 plugin accessing the data in a template was created by Alan Sparkes
I think i understand how the K2 plugins work to add input fileds into admin screens of K2.The plugin example like youtube (thanks Fotis) stores values in the item table in a field called plugins and subsequent new plugins store data just like standard params.

I want to use the plugin data stored in this field in my template but I cant find a standard way. For example in my item template i have:

$pluginParams = new K2Parameter($this->item->plugins,'','formchooser');


This lets me get the form id from my form chooser plugin in K2. The value is in the db and this ;
print_r($pluginParams);  

spits out the data:

K2Parameter Object ( [namespace] => formchooser [_raw] => k2storeitem_price= formchooserformid=3 youtubevideoURL_item= [_xml] => [_elements] => Array ( ) [_elementPath] => Array ( [0] => /home/www/public_html/libraries/joomla/html/parameter/element [1] => /home/www/public_html/administrator/components/com_k2/elements ) [_defaultNameSpace] => _default [_registry] => Array ( [_default] => Array ( [data] => stdClass Object ( [k2storeitem_price] => [formchooserformid] => 3 [youtubevideoURL_item] => ) ) ) [_errors] => Array ( ) )

this is great I can see my data in there but there doesnt seem to be a standard joomla way to access the formchooserformid value

Is there a joomla way to pull these values into the template?

Please Log in or Create an account to join the conversation.

  • Alan Sparkes
  • Alan Sparkes's Avatar Topic Author
  • Offline
  • Premium Member
More
14 years 5 months ago #85076 by Alan Sparkes
Replied by Alan Sparkes on topic K2 plugin accessing the data in a template
Yes of course
$pluginParams->_registry->formchooserformid

This seems unfriendly but gets the result.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum