5e0265340613ec2f2947e649c87f0b4438317d48
[yaffs-website] / web / modules / contrib / metatag / metatag_pinterest / src / Plugin / metatag / Tag / PinterestNopin.php
1 <?php
2
3 namespace Drupal\metatag_pinterest\Plugin\metatag\Tag;
4
5 use Drupal\metatag\Plugin\metatag\Tag\MetaNameBase;
6
7 /**
8  * The Pinterest "nopin" meta tag.
9  *
10  * @MetatagTag(
11  *   id = "pinterest_nopin",
12  *   label = @Translation("No pin"),
13  *   description = @Translation("Do not pin anything from this page. When selected, this option will take precedence over all options below."),
14  *   name = "pinterest",
15  *   group = "pinterest",
16  *   weight = 1,
17  *   type = "string",
18  *   secure = FALSE,
19  *   multiple = FALSE
20  * )
21  */
22 class PinterestNopin extends MetaNameBase {
23
24   /**
25    * {@inheritdoc}
26    */
27   public function form(array $element = []) {
28     $form = [
29       '#type' => 'checkbox',
30       '#title' => $this->label(),
31       '#description' => $this->description(),
32       '#default_value' => ($this->value === 'nopin') ?: '',
33       '#required' => isset($element['#required']) ? $element['#required'] : FALSE,
34       '#element_validate' => [[get_class($this), 'validateTag']],
35       '#return_value' => 'nopin',
36     ];
37
38     return $form;
39   }
40
41 }