You are here

private function AdminSettingsForm::buildFieldMappingsForm in Acquia Lift Connector 8.4

Same name and namespace in other branches
  1. 8 src/Form/AdminSettingsForm.php \Drupal\acquia_lift\Form\AdminSettingsForm::buildFieldMappingsForm()
  2. 8.3 src/Form/AdminSettingsForm.php \Drupal\acquia_lift\Form\AdminSettingsForm::buildFieldMappingsForm()

Build field mappings form.

Return value

array Field mappings form.

1 call to AdminSettingsForm::buildFieldMappingsForm()
AdminSettingsForm::buildForm in src/Form/AdminSettingsForm.php
Form constructor.

File

src/Form/AdminSettingsForm.php, line 242

Class

AdminSettingsForm
Defines a form that configures settings.

Namespace

Drupal\acquia_lift\Form

Code

private function buildFieldMappingsForm() {
  $field_mappings_settings = $this
    ->config('acquia_lift.settings')
    ->get('field_mappings');
  $field_names = $this
    ->getTaxonomyTermFieldNames();
  $form = [
    '#title' => $this
      ->t('Field Mappings'),
    '#description' => $this
      ->t('Create <a href="@url" target="_blank">Taxonomy vocabularies</a> and map to "content section", "content keywords", and "persona" fields.', [
      '@url' => Url::fromRoute('entity.taxonomy_vocabulary.collection')
        ->toString(),
    ]),
    '#type' => 'details',
    '#tree' => TRUE,
    '#group' => 'data_collection_settings',
  ];
  $form['content_section'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Content Section'),
    '#empty_value' => '',
    '#options' => $field_names,
    '#default_value' => $field_mappings_settings['content_section'],
  ];
  $form['content_keywords'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Content Keywords'),
    '#empty_value' => '',
    '#options' => $field_names,
    '#default_value' => $field_mappings_settings['content_keywords'],
  ];
  $form['persona'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Persona'),
    '#empty_value' => '',
    '#options' => $field_names,
    '#default_value' => $field_mappings_settings['persona'],
  ];
  return $form;
}