You are here

public static function FormTrait::createElement in Markdown 8.2

Creates an element, adding data attributes to it if necessary.

Parameters

array $element: An element.

Return value

array The modified $element.

6 calls to FormTrait::createElement()
FilterMarkdown::processSubform in src/Plugin/Filter/FilterMarkdown.php
Process callback for constructing markdown settings for this filter.
FormTrait::resetToDefault in src/Traits/FormTrait.php
Allows a form element to be reset to its default value.
ParserConfigurationForm::buildParser in src/Form/ParserConfigurationForm.php
Builds the parser form elements.
ParserConfigurationForm::buildParserExtensions in src/Form/ParserConfigurationForm.php
Builds the extension settings for a specific parser.
ParserConfigurationForm::processSubform in src/Form/ParserConfigurationForm.php
Process callback for constructing markdown settings for a parser.

... See full list

File

src/Traits/FormTrait.php, line 94

Class

FormTrait
Trait providing helpful methods when dealing with forms.

Namespace

Drupal\markdown\Traits

Code

public static function createElement(array $element) {
  if (isset($element['#attributes']['data']) && is_array($element['#attributes']['data'])) {
    static::addDataAttributes($element, $element['#attributes']['data']);
    unset($element['#attributes']['data']);
  }
  return $element;
}