0

I have a configuration value that I encrypt upon save, but when I look at it again in the configuration (UI), I get the encrypted string. I would like to show an empty string (production) or the correct decrypted value (for testing), but cannot quite figure out how to do this.

The logical way I know of is to write a source model, but those seem to only work for select elements. This is a simple text field. I need a way to receive the original data, decrypt with (with Magento\Framework\Encryption\EncryptorInterface), and display the decrypted value; either that or an empty value.

1 Answer 1

0

Partial answer:

Turns out, in this specific case, it's possible to have Magento decrypt the value automatically on display / retrieval, by setting a backend model in config.xml too. For example:

<section>
    <group>
        <field backend_model="Magento\Config\Model\Config\Backend\Encrypted" />
    </group>
</section>

However, it does not answer the question's general case (especially the blank value), an answer addressing this would be appreciated!

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.