You are here

public function SchemaActionBase::form in Schema.org Metatag 8

Generate a form element for this meta tag.

Parameters

array $element: The existing form element to attach to.

Return value

array The completed form element.

Overrides MetaNameBase::form

4 calls to SchemaActionBase::form()
SchemaMetatagTestAction::form in tests/modules/schema_metatag_test/src/Plugin/metatag/Tag/SchemaMetatagTestAction.php
Generate a form element for this meta tag.
SchemaMoviePotentialAction::form in schema_movie/src/Plugin/metatag/Tag/SchemaMoviePotentialAction.php
Generate a form element for this meta tag.
SchemaOrganizationPotentialAction::form in schema_organization/src/Plugin/metatag/Tag/SchemaOrganizationPotentialAction.php
Generate a form element for this meta tag.
SchemaWebSitePotentialAction::form in schema_web_site/src/Plugin/metatag/Tag/SchemaWebSitePotentialAction.php
Generate a form element for this meta tag.
4 methods override SchemaActionBase::form()
SchemaMetatagTestAction::form in tests/modules/schema_metatag_test/src/Plugin/metatag/Tag/SchemaMetatagTestAction.php
Generate a form element for this meta tag.
SchemaMoviePotentialAction::form in schema_movie/src/Plugin/metatag/Tag/SchemaMoviePotentialAction.php
Generate a form element for this meta tag.
SchemaOrganizationPotentialAction::form in schema_organization/src/Plugin/metatag/Tag/SchemaOrganizationPotentialAction.php
Generate a form element for this meta tag.
SchemaWebSitePotentialAction::form in schema_web_site/src/Plugin/metatag/Tag/SchemaWebSitePotentialAction.php
Generate a form element for this meta tag.

File

src/Plugin/metatag/Tag/SchemaActionBase.php, line 30

Class

SchemaActionBase
Schema.org Action items should extend this class.

Namespace

Drupal\schema_metatag\Plugin\metatag\Tag

Code

public function form(array $element = []) {
  $value = $this
    ->schemaMetatagManager()
    ->unserialize($this
    ->value());
  $input_values = [
    'title' => $this
      ->label(),
    'description' => $this
      ->description(),
    'value' => $value,
    '#required' => isset($element['#required']) ? $element['#required'] : FALSE,
    'visibility_selector' => $this
      ->visibilitySelector(),
    'actions' => $this->actions,
  ];
  $form = $this
    ->actionForm($input_values);
  if (empty($this
    ->multiple())) {
    unset($form['pivot']);
  }
  return $form;
}