You are here

public function SchemaImageBase::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

1 call to SchemaImageBase::form()
SchemaPersonImage::form in schema_person/src/Plugin/metatag/Tag/SchemaPersonImage.php
Generate a form element for this meta tag.
1 method overrides SchemaImageBase::form()
SchemaPersonImage::form in schema_person/src/Plugin/metatag/Tag/SchemaPersonImage.php
Generate a form element for this meta tag.

File

src/Plugin/metatag/Tag/SchemaImageBase.php, line 15

Class

SchemaImageBase
Schema.org Image 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' => $this
      ->schemaMetatagManager()
      ->unserialize($this
      ->value()),
    '#required' => isset($value['#required']) ? $value['#required'] : FALSE,
    'visibility_selector' => $this
      ->visibilitySelector(),
  ];
  $form = $this
    ->imageForm($input_values);
  if (empty($this
    ->multiple())) {
    unset($form['pivot']);
  }
  return $form;
}