You are here

public function ContextMetadata::buildConfigurationForm in Context Metadata 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/ContextReaction/ContextMetadata.php \Drupal\context_metadata\Plugin\ContextReaction\ContextMetadata::buildConfigurationForm()

File

src/Plugin/ContextReaction/ContextMetadata.php, line 21

Class

ContextMetadata
Provides a content reaction that adds a Metadata.

Namespace

Drupal\context_metadata\Plugin\ContextReaction

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  $form['metadata_title'] = array(
    '#title' => $this
      ->t('Meta Title'),
    '#description' => $this
      ->t('Title goes here'),
    '#type' => 'textfield',
    '#maxlength' => 256,
    '#default_value' => $this
      ->getConfiguration()['metadata_title'],
  );
  $form['metadata_description'] = array(
    '#title' => $this
      ->t('Meta Description'),
    '#description' => $this
      ->t('Meta Description'),
    '#type' => 'textfield',
    '#maxlength' => 400,
    '#default_value' => $this
      ->getConfiguration()['metadata_description'],
  );
  $form['metadata_keywords'] = array(
    '#title' => $this
      ->t('Meta Keywords'),
    '#description' => $this
      ->t('Meta Keywords'),
    '#type' => 'textfield',
    '#maxlength' => 400,
    '#default_value' => $this
      ->getConfiguration()['metadata_keywords'],
  );
  $form['metadata_canonical_url'] = array(
    '#title' => $this
      ->t('Canonical URL'),
    '#description' => $this
      ->t('Canonical URL'),
    '#type' => 'textfield',
    '#maxlength' => 400,
    '#default_value' => $this
      ->getConfiguration()['metadata_canonical_url'],
  );

  // TODO: Add this once we have other metadata working.

  /*$form['metadata_h1_title'] = array(
      '#title' => $this->t('H1 tag'),
      '#description' => $this->t('Overrides the H1 title'),
      '#type' => 'textfield',
      '#maxlength' => 400,
      '#default_value' => $this->getConfiguration()['metadata_h1_title'],
    );*/

  // TODO: Add this once we have other metadata working.

  /*$form['metadata_robots'] = array(
      '#title' => $this->t('Robots'),
      '#description' => $this->t('Robots'),
      '#type' => 'textfield',
      '#maxlength' => 400,
      '#default_value' => $this->getConfiguration()['metadata_robots'],
    );*/
  return $form;
}