You are here

public function PropertyTypeBase::formElement in Schema.org Metatag 8.2

A property form element.

This will actually be rendered only by properties that have no more sub-properties.

Parameters

array $input_values: The array of input values used by form().

Return value

array A form array.

Overrides PropertyTypeInterface::formElement

4 calls to PropertyTypeBase::formElement()
Date::formElement in src/Plugin/schema_metatag/PropertyType/Date.php
A property form element.
DateTime::formElement in src/Plugin/schema_metatag/PropertyType/DateTime.php
A property form element.
Duration::formElement in src/Plugin/schema_metatag/PropertyType/Duration.php
A property form element.
PropertyTypeBase::form in src/Plugin/schema_metatag/PropertyTypeBase.php
Create a complete form element for this property type.
5 methods override PropertyTypeBase::formElement()
Boolean::formElement in src/Plugin/schema_metatag/PropertyType/Boolean.php
A property form element.
Date::formElement in src/Plugin/schema_metatag/PropertyType/Date.php
A property form element.
DateTime::formElement in src/Plugin/schema_metatag/PropertyType/DateTime.php
A property form element.
Duration::formElement in src/Plugin/schema_metatag/PropertyType/Duration.php
A property form element.
Type::formElement in src/Plugin/schema_metatag/PropertyType/Type.php
A property form element.

File

src/Plugin/schema_metatag/PropertyTypeBase.php, line 245

Class

PropertyTypeBase
Base class for Property type plugins.

Namespace

Drupal\schema_metatag\Plugin\schema_metatag

Code

public function formElement(array $input_values) {
  $value = $input_values['value'];
  $form['#type'] = 'textfield';
  $form['#title'] = $input_values['title'];
  $form['#description'] = $input_values['description'];
  $form['#default_value'] = !empty($value) ? $value : '';
  $form['#maxlength'] = 255;
  return $form;
}