You are here

public function SchemaPlaceBase::getForm in Schema.org Metatag 7

Build the form for this meta tag.

Return value

array A standard FormAPI array.

Overrides SchemaAddressBase::getForm

File

src/SchemaPlaceBase.php, line 13

Class

SchemaPlaceBase
Schema.org Place items should extend this class.

Code

public function getForm(array $options = []) {
  $value = $this
    ->schemaMetatagManager()
    ->unserialize($this
    ->value());
  $input_values = [
    'title' => $this
      ->label(),
    'description' => $this
      ->description(),
    'value' => $value,
    '#required' => isset($options['#required']) ? $options['#required'] : FALSE,
    'visibility_selector' => $this
      ->visibilitySelector(),
  ];
  $form['value'] = $this
    ->placeForm($input_values);
  if (empty($this
    ->multiple())) {
    unset($form['value']['pivot']);
  }

  // Validation from parent::getForm() got wiped out, so add callback.
  $form['value']['#element_validate'][] = 'schema_metatag_element_validate';
  return $form;
}