By mirom on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.0.x
Issue links:
Description:
Added helper method to the Attribute class to help test existence of CSS class in PHP and Twig templates.
Twig before:
{% if 'node' in attributes.class.value %}
Twig after:
{% if attributes.hasClass('node') %}
PHP before:
<?php
$classes = $variables['attributes']['class']->value();
if(in_array('node', $classes))
{
// write your code
}
?>
PHP after:
<?php
if($variables['attributes']->hasClass('node'))
{
// write your code
}
?>
Impacts:
Module developers
Themers