public function Referrer::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
- src/
Plugin/ metatag/ Tag/ Referrer.php, line 29
Class
- Referrer
- The basic "Referrer policy" meta tag.
Namespace
Drupal\metatag\Plugin\metatag\TagCode
public function form(array $element = []) {
$form = [
'#type' => 'select',
'#title' => $this
->label(),
'#description' => $this
->description(),
'#options' => [
'no-referrer' => $this
->t('No Referrer'),
'no-referrer-when-downgrade' => $this
->t('No Referrer When Downgrade'),
'origin' => $this
->t('Origin'),
'origin-when-cross-origin' => $this
->t('Origin When Cross-Origin'),
'same-origin' => $this
->t('Same Origin'),
'strict-origin' => $this
->t('Strict Origin'),
'strict-origin-when-cross-origin' => $this
->t('Strict Origin When Cross-Origin'),
'unsafe-url' => $this
->t('Unsafe URL'),
],
'#empty_option' => $this
->t('- None -'),
'#empty_value' => '',
'#default_value' => $this
->value(),
'#required' => isset($element['#required']) ? $element['#required'] : FALSE,
'#element_validate' => [
[
get_class($this),
'validateTag',
],
],
];
return $form;
}