4

In Magento 2.3.3 I add the following code to display the image in system configuration tab at Label but now not display image only display image tag as a text.

<tab id="mytab" translate="label" sortOrder="110">
    <label><![CDATA[<img src="http://logos-download.com/wp-content/uploads/2016/09/Magento_logo.png" width="100px"/>]]></label>
</tab>

enter image description here

4
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="section_id_here" translate="label" type="text" sortOrder="400" showInDefault="1" showInWebsite="1" showInStore="1">
            <label>Section label</label>
            <tab>tab_name</tab>
            <resource>Vendor_Module::acl_name</resource>
            <class>css-class</class>
        </section>
    </system>
</config>

Now you get a special class (css-class ) added to your section and you can control that via css files.

It works for tabs also but a bit different. The class must be added as an attribute

   <tab id="tab_id" translate="label" sortOrder="400" class="css-class">
        <label>Tab label</label>
    </tab>
| improve this answer | |
1

I had this problem too, you can override the template vendor/magento/module-config/view/adminhtml/templates/system/config/tabs.phtml this way :

<div class="admin__page-nav-title title _collapsible" data-role="title">
    <strong>
    <?php
    $label = $_tab->getLabel();
    echo strpos($label, '<img') !== false
                            ? $label
                            : $block->escapeHtml($label)
    ?>
    </strong>
</div>
| improve this answer | |

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.