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.

2
  • 1
    In your getParams call above you've got com_sljooma instead of com_sljoomla. Commented Dec 24, 2019 at 19:07
  • Thank You Robbie can't believe i missed that now its working :) Commented Dec 25, 2019 at 21:06

1 Answer 1

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');
3
  • 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? Commented Dec 24, 2019 at 12:33
  • 1
    It's a core class.
    – Sharky
    Commented Dec 25, 2019 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.. Commented Dec 25, 2019 at 19:50

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.