Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ElementInterface.php

function ElementInterface::setAttributes

Sets a form element's class attribute.

Adds 'required' and 'error' classes as needed.

Parameters

array $element: The form element.

array $class: Array of new class names to be added.

1 method overrides ElementInterface::setAttributes()
RenderElementBase::setAttributes in core/lib/Drupal/Core/Render/Element/RenderElementBase.php
Sets a form element's class attribute.

File

core/lib/Drupal/Core/Render/Element/ElementInterface.php, line 53

Class

ElementInterface
Provides an interface for render element plugins.

Namespace

Drupal\Core\Render\Element

Code

public static function setAttributes(&$element, $class = []);
RSS feed
Powered by Drupal