Hi,
I am working with Menu Parameters for the first time and I need a little bit of help.
From what I have figured out so far I can define menu parameters which are either appended to the URL or saved in the 'params' field in the database.
So I get either: index.php?option=com_mycomponent&view=default&id=2&theme=green
Or: {"id":"2","theme":"green","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","menu_text":1,"page_title":"","show_page_heading":0,"page_heading":"","pageclass_sfx":"","menu-meta_description":"","menu-meta_keywords":"","robots":"","secure":0}
What I would really like is for the ID parameter to be appended to the URL and for the THEME parameter to be stored in the database. But I'm not sure how to split them like this.
This is my default.xml file:
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="SL_COMP_MENU_ITEM_TYPE">
<message>
<![CDATA[SL_COMP_MENU_ITEM_TYPE_DESC]]>
</message>
</layout>
<fields name="request">
<fieldset name="request" addfieldpath="/administrator/components/com_mycomponent/models/fields">
<field name="id" type="modal_comp" label="SL_CO_SELECT" required="true" />
<field name="theme" type="list" label="SL_SELECT_THEME" required="true">
<option value="green">Green</option>
<option value="blue">Blue</option>
<option value="red">Red</option>
</field>
</fieldset>
</fields>
</metadata>
My changing <fields name="request"> to <fields name="params"> I get ID and THEME stored in the 'params' but like I said, I'd like ID to be in the URL and THEME to be in the database. Hope I've made sense!!
Many thanks,
Mark
Will I have to run a script on upgrade to check for this or is there a better way?