0

I just wanted to get system configuration value inside layout file which is exists inside ui_component, is there any way ?

1 Answer 1

0

Try this all step it will be usefull to you

1.In your layout file (e.g., my_layout_file.xml), define a block and specify its template

 <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="my.block.name">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Vendor_Module::my_template.phtml</argument>
            </action>
        </referenceBlock>
    </body>
</page>

2.Create a template file (e.g., my_template.phtml) and retrieve the system configuration value

<?php
$storeConfigValue = $this->helper('Magento\Config\Helper\Data')->getStoreConfig('section_name/group_name/field_name');
?>

Replace 'section_name/group_name/field_name' with the actual path to the configuration field you want to access. For example, if you want to access the value of a field with the path 'general/store_information/name

 $storeConfigValue = $this->helper('Magento\Config\Helper\Data')->getStoreConfig('general/store_information/name');

That you may need to adjust the helper class depending on the specific context of your module.

As for the error you mentioned, please provide more details about the specific error message you're encountering, and I'll do my best to assist you in resolving it.

1
  • I just wanted to get yes/ no configuration value inside argument item field
    – Eion
    May 25 at 9:20

Your Answer

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

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