You are here

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

File

src/Plugin/PardotFormMapFormatterPlugin/AutoPath.php, line 73

Class

AutoPath
Plugin to have an autocomplete textfield for typed data.

Namespace

Drupal\pardot\Plugin\PardotFormMapFormatterPlugin

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  $entity_id = explode(':', $this->configuration['entity_id'])[1] ?? '';
  $form['path'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('autocomplete'),
    '#autocomplete_route_name' => 'pardot.autocomplete',
    '#description' => $this
      ->t('Enter the form handler post url from Pardot.'),
    '#default_value' => $this->configuration['path'],
    '#autocomplete_route_parameters' => [
      'entity_id' => $entity_id,
    ],
  ];
  return $form;
}