public function TwitterCardsType::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_twitter_cards/
src/ Plugin/ metatag/ Tag/ TwitterCardsType.php, line 30
Class
- TwitterCardsType
- The Twitter Cards Type-tag.
Namespace
Drupal\metatag_twitter_cards\Plugin\metatag\TagCode
public function form(array $element = []) {
$form = [
'#type' => 'select',
'#title' => $this
->label(),
'#description' => $this
->description(),
'#options' => [
'summary' => $this
->t('Summary Card'),
'summary_large_image' => $this
->t('Summary Card with large image'),
'photo' => $this
->t('Photo Card'),
'gallery' => $this
->t('Gallery Card'),
'app' => $this
->t('App Card'),
'player' => $this
->t('Player Card'),
'product' => $this
->t('Product Card'),
],
'#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;
}