I have just started using Joomla and I've been following the create a Hello World component tutorial. After some major headaches and starting over and over again, i'm finally getting somewhere
I now have a working component and in my component options I've got a drop down list populated by a SQL query as shown in my admin/config.xml
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset
name="greetings"
label="COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_LABEL"
description="COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_DESC"
>
<field
name="greeting"
type="sql"
label="Select an article"
query="SELECT id, greeting FROM #__helloworld"
key_field="id" />
</fieldset>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC"
>
<field
name="rules"
type="rules"
label="JCONFIG_PERMISSIONS_LABEL"
class="inputbox"
validate="rules"
filter="rules"
component="com_helloworld"
section="component"
/>
</fieldset>
</config>
I have got the same problem as this chap asking this question How to set Component parameters in J2.5?
I want to select an option and update my component table so the id of the selected option is updated in another column (default).
The params field isn't updated and it seems like it's doing nothing event though it probably is.
Is there a class in the admin/models
folder that i should be updating to update the database and if so what do i put? I've been searching for hours and any answer that i come across just gives the code and not what function to put it in
Extension config data is stored in the #__extensions table under the params column as json.
Looking through the joomla source in my IDE there doesn't seem to be a wrapper for updating extension params so a query like below will have to do.
FYI the query is untested and is just an example of the required approach