1

Currently working on a magento homepage layout that includes a static block widget through the CMS (as opposed to referencing it through XML layouts) but no matter what I do I can't alter the classes generated when rendering.

The widget currently renders the following tag

<div class="widget block block-static-block"> </div>

I have tried adding it through the htmlClass argument through a referenceblock to the widget ID in layout XML but that's not working. Any other ideas?

1

Use argument of css_class You can call your block directly from the xml layout(Thats what i did at magento 1.x)

i Guess you can do it on phtml but thats not was approach for my opinion

<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.sku" template="product/view/attribute.phtml" after="product.info.type">
<arguments>
    <argument name="at_call" xsi:type="string">getSku</argument>
    <argument name="at_code" xsi:type="string">sku</argument>
    <argument name="css_class" xsi:type="string">my-class</argument>//here
</arguments

this is from the official magento 2 docs

http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/xml-manage.html

Please read it before you asking and go directly for SE

Happy coding Mate

  • Snarky comment aside, I'd already read that but the way it read looked like it only applied to block elements that are instantiated in the XML, this block is created through magento_cms and referenceBlock/argument nodes do not seem to affect it. – Lawrence Mar 3 '16 at 17:14
  • Did you try to call the cms block via xml? – Goldy Mar 3 '16 at 20:19
  • Initially tried to call it via the GUI widget layout update. – Lawrence Mar 8 '16 at 15:31

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.