Final Class Yiisoft\Yii\DataView\HtmlHelper
| Inheritance | Yiisoft\ |
|---|
Public Methods
| Method | Description | Defined By |
|---|---|---|
| mergeAttributes() | Merges HTML attributes on top of a base set, appending (rather than replacing) the class attribute. |
Yiisoft\ |
Method Details
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);
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.