How to get component parameters?
I have a problem here and just cant solve it :-/
I am developing an Joomla component with backend.
In the backend I set a parameter, the dashboardId
, but I can't access them in the view. I always get data:protected
(when I dump params
). It seems like I'm not allowed to access the object.
Here is the default.xml
:
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="Dashboard">
<message>
<![CDATA[dashboard LAYOUT DESCRIPTION]]>
</message>
</layout>
<fields name="params">
<fieldset name="params">
<field
name="dashboardId"
type="text"
label="Dashboard ID"
description="com_dashboard_desc"
default="1"
>
</field>
</fieldset>
</fields>
</metadata>
Now, in the view.html.php
I try to access the parameter like this:
$app = &JFactory::getApplication();
$params = JComponentHelper::getParams('com_dashboard');
$dashboardId = $params->get('dashboardId');
var_dump($dashboardId);
When I do var_dump($dashboardId);
I get NULL
but when I dump $app
, I can see the dashboardID
every help would be appreciated! Thanks