You are here

public function SchemaActionBase::getForm in Schema.org Metatag 7

Build the form for this meta tag.

Return value

array A standard FormAPI array.

Overrides SchemaNameBase::getForm

3 calls to SchemaActionBase::getForm()
SchemaMoviePotentialAction::getForm in schema_movie/src/SchemaMoviePotentialAction.php
Generate a form element for this meta tag.
SchemaOrganizationPotentialAction::getForm in schema_organization/src/SchemaOrganizationPotentialAction.php
Generate a form element for this meta tag.
SchemaWebSitePotentialAction::getForm in schema_web_site/src/SchemaWebSitePotentialAction.php
Generate a form element for this meta tag.
3 methods override SchemaActionBase::getForm()
SchemaMoviePotentialAction::getForm in schema_movie/src/SchemaMoviePotentialAction.php
Generate a form element for this meta tag.
SchemaOrganizationPotentialAction::getForm in schema_organization/src/SchemaOrganizationPotentialAction.php
Generate a form element for this meta tag.
SchemaWebSitePotentialAction::getForm in schema_web_site/src/SchemaWebSitePotentialAction.php
Generate a form element for this meta tag.

File

src/SchemaActionBase.php, line 28

Class

SchemaActionBase
Schema.org Action items should extend this class.

Code

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

  // Validation from parent::getForm() got wiped out, so add callback.
  $form['value']['#element_validate'][] = 'schema_metatag_element_validate';
  return $form;
}