You are here

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

File

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

Class

SchemaReviewBase
Provides a plugin to extend for the 'Review' meta tag.

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(),
  ];
  $form = parent::form($element);
  $form = $this
    ->reviewForm($input_values);
  if (empty($this
    ->multiple())) {
    unset($form['pivot']);
  }
  return $form;
}