I just wanted to get system configuration value inside layout file which is exists inside ui_component, is there any way ?
1 Answer
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.