3 namespace Drupal\metatag_twitter_cards\Plugin\metatag\Tag;
5 use Drupal\metatag\Plugin\metatag\Tag\MetaNameBase;
8 * The Twitter Cards Type-tag.
11 * id = "twitter_cards_type",
12 * label = @Translation("Twitter card type"),
13 * description = @Translation("Notes:<ul><li>no other fields are required for a Summary card</li><li>Photo card requires the 'image' field</li><li>Media player card requires the 'title', 'description', 'media player URL', 'media player width', 'media player height' and 'image' fields,</li><li>Summary Card with Large Image card requires the 'Summary' field and the 'image' field,</li><li>Gallery Card requires all the 'Gallery Image' fields,</li><li>App Card requires the 'iPhone app ID' field, the 'iPad app ID' field and the 'Google Play app ID' field,</li><li>Product Card requires the 'description' field, the 'image' field, the 'Label 1' field, the 'Data 1' field, the 'Label 2' field and the 'Data 2' field.</li></ul>"),
14 * name = "twitter:card",
15 * group = "twitter_cards",
22 class TwitterCardsType extends MetaNameBase {
27 public function form(array $element = []) {
30 '#title' => $this->label(),
31 '#description' => $this->description(),
33 'summary' => t('Summary Card'),
34 'summary_large_image' => t('Summary Card with large image'),
35 'photo' => t('Photo Card'),
36 'gallery' => t('Gallery Card'),
37 'app' => t('App Card'),
38 'player' => t('Player Card'),
39 'product' => t('Product Card'),
41 '#empty_option' => t('- None -'),
43 '#default_value' => $this->value(),
44 '#required' => isset($element['#required']) ? $element['#required'] : FALSE,
45 '#element_validate' => [[get_class($this), 'validateTag']],