Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing setting via FormIt hook always yields empty value #186

Open
sonicpunk opened this issue Mar 16, 2021 · 7 comments
Open

Accessing setting via FormIt hook always yields empty value #186

sonicpunk opened this issue Mar 16, 2021 · 7 comments

Comments

@sonicpunk
Copy link

Summary

Trying to access a setting field using $modx->getOption() always returns an empty string.

Step to reproduce

Inside of a hook snippet try to call up a ClientConfig setting

Observed behavior

It returns empty

Expected behavior

It should return the saved value

Environment

ClientConfig version 2.3.0-pl, FormIt version 4.2.5-pl, MODX version 2.7.2-advanced, Operating System Apache, MySQL 5.6 version, PHP version 7.3

@Mark-H
Copy link
Member

Mark-H commented Mar 16, 2021

Definitely checked for typos in the key name? And it does work if you place the same snippet just on the page instead of as a hook?

@sonicpunk
Copy link
Author

Hey Mark, I tested it as just a snippet and it also returns no value. I checked the name of the key a million times. If I call it using placeholder, it does render the value.

[[++webinar_confirmation_email_text_en]]

$emailText = $modx->getOption('webinar_confirmation_email_text_en', null, '');

Swapping out the key name with a standard modx system setting returns a value.

@sonicpunk
Copy link
Author

If I add the key as a placeholder in the template, then the snippet call on the same page also gets the value and outputs it to the modx log. Something weird going on,

@Mark-H
Copy link
Member

Mark-H commented Mar 16, 2021

That sure does sound weird. Is this a global setting or a context-specific one that may be affected by #109?

@sonicpunk
Copy link
Author

Event a simple snippet placed in the template like this returns nothing:

$emailText = $modx->getOption('webinar_confirmation_text_en', null, '', true); return $emailText;

but the placeholder does:
[[++webinar_confirmation_text_en]]

Both MODX events are activated on the plugin. The setting is a global setting. We are using language contexts.

@Mark-H
Copy link
Member

Mark-H commented Mar 16, 2021

If you can email a login to [email protected], with a link to this issue, I'd like to do some debugging to see what might be going on there. Should have some spare time near the end of the week to take a look.

@sebastian-marinescu
Copy link
Contributor

I'm not sure if it's related, but in my case on the Contact-Form the "contact-mail" setting, which is also a ClientConfig-setting wouldn't work, unless I called it un-cached:

&emailTo=`[[!++contact_mail]]`

Just leaving it here for future problem-solvers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants