0

I am having an issue with the Access component parameters from inside own component. I have tried the code listed in the first answer, but it did not work.

Below is an image of the back end config field, that I would like to access in my front end views.

back end config field I would like to use

If anyone knows the right way to access this I could use a pointer :)

EDIT UPDATE:

This is a image of the Database field so it is in the DB DB image

And what I entered in my front end file:

// Import `ComponentHelper` class.
use Joomla\CMS\Component\ComponentHelper;

// Get all params of a specific component.
$params = ComponentHelper::getParams('com_sljooma');

// To get the value of the param.
$token_salt = $params->get('security_token');

If I echo $token_salt, nothing is being returned. I'm not sure what I am missing.

  • 1
    In your getParams call above you've got com_sljooma instead of com_sljoomla. – Robbie Jackson Dec 24 '19 at 19:07
  • Thank You Robbie can't believe i missed that now its working :) – Christopher Cox Dec 25 '19 at 21:06
1
// Import `ComponentHelper` class.
use Joomla\CMS\Component\ComponentHelper;

// Get all params of a specific component.
$params = ComponentHelper::getParams('com_yourcomponent');

// To get the value of the param.
$params->get('yourParam');
| improve this answer | |
  • Do i need to build my own Component Helper file to load this info from the Database or is this set up a joomla 3 core? – Christopher Cox Dec 24 '19 at 12:33
  • 1
    It's a core class. – Sharky Dec 25 '19 at 7:42
  • thank you so much for the help, but still could not get it to work so i just created a function in my helper file to pull it from the Database.. – Christopher Cox Dec 25 '19 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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