You are here

public function SchemaMovieReleasedEvent::form in Schema.org Metatag 8

Generate a form element for this meta tag.

Overrides SchemaEventBase::form

File

schema_movie/src/Plugin/metatag/Tag/SchemaMovieReleasedEvent.php, line 31

Class

SchemaMovieReleasedEvent
Provides a plugin for the 'schema_movie_released_event' meta tag.

Namespace

Drupal\schema_movie\Plugin\metatag\Tag

Code

public function form(array $element = []) {
  $form = parent::form($element);

  // This should only be a PublicationEvent.
  unset($form['@type']['#options']['Event']);

  // Highlight the fields that Google recommends.
  $recommended = [
    'startDate',
    'location',
  ];
  foreach ($recommended as $key) {
    $description = $this
      ->t('RECOMMENDED BY GOOGLE.') . ' ' . $form[$key]['#description'];
    $form[$key]['#description'] = $description;
  }
  return $form;
}