You are here

interface ElementInterface in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/behat/mink/src/Element/ElementInterface.php \Behat\Mink\Element\ElementInterface
  2. 8.0 core/modules/config_translation/src/FormElement/ElementInterface.php \Drupal\config_translation\FormElement\ElementInterface
  3. 8.0 core/lib/Drupal/Core/Render/Element/ElementInterface.php \Drupal\Core\Render\Element\ElementInterface
Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Render/Element/ElementInterface.php \Drupal\Core\Render\Element\ElementInterface

Provides an interface for render element plugins.

Render element plugins allow modules to declare their own Render API element types and specify the default values for the properties. The values returned by the getInfo() method of the element plugin will be merged with the properties specified in render arrays. Thus, you can specify defaults for any Render API keys, in addition to those explicitly documented by \Drupal\Core\Render\ElementInfoManagerInterface::getInfo().

Some render elements are specifically form input elements; see \Drupal\Core\Render\Element\FormElementInterface for more information.

Hierarchy

Expanded class hierarchy of ElementInterface

All classes that implement ElementInterface

See also

\Drupal\Core\Render\ElementInfoManager

\Drupal\Core\Render\Annotation\RenderElement

\Drupal\Core\Render\Element\RenderElement

Plugin API

Related topics

File

core/lib/Drupal/Core/Render/Element/ElementInterface.php, line 32
Contains \Drupal\Core\Render\Element\ElementInterface.

Namespace

Drupal\Core\Render\Element
View source
interface ElementInterface extends PluginInspectionInterface {

  /**
   * Returns the element properties for this element.
   *
   * @return array
   *   An array of element properties. See
   *   \Drupal\Core\Render\ElementInfoManagerInterface::getInfo() for
   *   documentation of the standard properties of all elements, and the
   *   return value format.
   */
  public function getInfo();

  /**
   * Sets a form element's class attribute.
   *
   * Adds 'required' and 'error' classes as needed.
   *
   * @param array $element
   *   The form element.
   * @param array $class
   *   Array of new class names to be added.
   */
  public static function setAttributes(&$element, $class = array());

}

Members

Namesort descending Modifiers Type Description Overrides
ElementInterface::getInfo public function Returns the element properties for this element. 52
ElementInterface::setAttributes public static function Sets a form element's class attribute. 1
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 2
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2