0

Final Class Yiisoft\Yii\DataView\HtmlHelper

InheritanceYiisoft\Yii\DataView\HtmlHelper

Public Methods

Hide inherited methods

Method Description Defined By
mergeAttributes() Merges HTML attributes on top of a base set, appending (rather than replacing) the class attribute. Yiisoft\Yii\DataView\HtmlHelper

Method Details

Hide inherited methods

mergeAttributes() public static method

Merges HTML attributes on top of a base set, appending (rather than replacing) the class attribute.

public static array mergeAttributes ( array $attributes, array $overlay )
$attributes array
$overlay array

                public static function mergeAttributes(array $attributes, array $overlay): array
{
    if (array_key_exists('class', $overlay)) {
        $class = $overlay['class'];
        unset($overlay['class']);
        /** @psalm-suppress MixedArgument, MixedArgumentTypeCoercion */
        Html::addCssClass($attributes, $class);
    }
    return array_merge($attributes, $overlay);
}