Class become in Drupal 8 like a string.

If I have 2 or more classes I can't use .hasClass() in .html.twig

My example.

Block class "col-md-4 block-white"

In block.html.twig

{% if not attributes.hasClass('col-md-4') %}
{% set classes = ['col-md-12'] %}
{% endif %}

And it don't work.

resolvet:
add in line 39 in Module Block_class in file block_class.module this content "$classes = explode(" ", $classes);"

Maybe you can find and other solution for this suggestions.

Comments

jonsecret created an issue. See original summary.

berenddeboer’s picture

Status: Active » Closed (cannot reproduce)

No clue what you try to say.