You are here

public function Token::buildConfigurationForm in Pardot Integration 2.x

File

src/Plugin/PardotFormMapFormatterPlugin/Token.php, line 65

Class

Token
Plugin to generate a text field and consume tokens for mappings.

Namespace

Drupal\pardot\Plugin\PardotFormMapFormatterPlugin

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  $token_types = $this->configuration['entity_types'];
  $form['token'] = [
    '#type' => 'textfield',
    '#title' => 'Token',
    '#default_value' => $this->configuration['token'],
    '#size' => 65,
    '#maxlength' => 1280,
    '#element_validate' => [
      'token_element_validate',
    ],
    '#after_build' => [
      'token_element_validate',
    ],
    '#token_types' => $token_types,
    '#min_tokens' => 1,
    '#required' => TRUE,
  ];
  $form['token_help'] = [
    '#theme' => 'token_tree_link',
    '#token_types' => $token_types,
  ];
  return $form;
}