0

I am building a custom admin component for Joomla!4 that includes an API.

To access the component's config I am using, on the API Controller file:

$params = ComponentHelper::getComponent('com_mycomponent')->getParams();

It seems a bit off to me to have go via the Component Helper to get my own component's params - in spite am I working on the API part of the code.

It works fine, but is that the proper way?

Thanks in advance.

1 Answer 1

1

The "more direct" way is:

ComponentHelper::getParams('com_example');

||

ComponentHelper::getParams('com_example')->get('yourParam');

But yes, is through ComponentHelper class

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.