1

Is it possible to have plain text next to the label in system config instead of an input field, something like:

<field>
    <label>Hey you</label>
    <plainText>Lorem ipsum...</plainText>
</field>

The closest I can get is using a label, but thats looks bad when I have more than 4 words in it. This is what it should look like:

Plain text in system config

  • 2
    U can use <comment>. What is point of giving label as value? – Ankit Shah May 12 '17 at 9:58
  • What you want to show as text only? – Ronak Chauhan May 12 '17 at 10:48
  • When I use <comment> im getting an inputfield. I want display a small note so that users can read that before they submit a file – creativename May 12 '17 at 11:02
6

system.xml

<field id="test" translate="label" type="label" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
    <label>Hey you!</label>
</field>

config.xml

app/code/Vendor/Module/etc/config.xml

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
    <default>
        <section>
            <group>
                <test>Your values here</test>
            </group>
        </section>
    </default>
</config>

OUTPUT:

enter image description here

  • I cant upvote because I dont have 15 rep yet – creativename May 15 '17 at 8:44
2

I also wanted to add custom text in store configuration and found below simple way to add custom text:

<field id="test" translate="label" type="label" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
    <label>NOTE: </label>
    <comment>Your Custom TEXT Here...</comment>
</field>                

Hope will be helpful for someone.

0

system.xml

<field id="test" type="label">
    <label>Test</label>
</field>

in config.xml define it's value

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
    <default>
        <groupname>
            <settings>
                <test>values</test>
            </settings>
        </groupname>
    </default>
</config>

Use CDATA[] if neeed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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