You are here

public function PinterestNosearch::form in 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

metatag_pinterest/src/Plugin/metatag/Tag/PinterestNosearch.php, line 27

Class

PinterestNosearch
The Pinterest "nosearch" meta tag.

Namespace

Drupal\metatag_pinterest\Plugin\metatag\Tag

Code

public function form(array $element = []) {
  $form = [
    '#type' => 'checkbox',
    '#title' => $this
      ->label(),
    '#description' => $this
      ->description(),
    '#default_value' => $this->value === 'nosearch' ?: '',
    '#required' => isset($element['#required']) ? $element['#required'] : FALSE,
    '#element_validate' => [
      [
        get_class($this),
        'validateTag',
      ],
    ],
    '#return_value' => 'nosearch',
  ];
  return $form;
}