/**
  * Create form elements to update field map.
  *
  * @return array
  * @internal param array $form
  * @internal param $scheduled_update_type
  *
  */
 protected function createFieldMapElements()
 {
     if ($this->entity->isNew()) {
         return [];
     }
     $field_map_help = 'Select the destination fields for this update type.' . ' Not all field have to have destinations if you using them for other purposes.';
     $elements = ['#type' => 'details', '#title' => 'destination fields', '#description' => $this->t($field_map_help), '#tree' => TRUE];
     $source_fields = $this->getSourceFields($this->entity);
     $field_map = $this->entity->getFieldMap();
     foreach ($source_fields as $source_field_id => $source_field) {
         $destination_fields_options = $this->getDestinationFieldsOptions($source_field);
         $elements[$source_field_id] = ['#type' => 'select', '#title' => $source_field->label(), '#options' => ['' => $this->t("(Not mapped)")] + $destination_fields_options, '#default_value' => isset($field_map[$source_field_id]) ? $field_map[$source_field_id] : ''];
     }
     return $elements;
 }
  /**
   * {@inheritdoc}
   */
  public function form(array $form, FormStateInterface $form_state) {
    $form = parent::form($form, $form_state);

    $form['type_dependent_elements'] = [];

    // @todo Should the runner configuration form even be displayed before entity type is selected?
    $form['type_dependent_elements']['update_runner'] = $this->createRunnerElements($form_state);
    $form['type_dependent_elements']['update_runner']['#weight'] = 100;

    $form['type_dependent_elements']['update_runner']['id'] += $this->typeDependentAjax();

    if ($this->entity->isNew()) {
      $form['type_dependent_elements'] += $this->createCloneFieldSelect($form, $form_state);
      $form['type_dependent_elements']['reference_settings'] = $this->createNewFieldsElements($form, $form_state);
    }

    $form['type_dependent_elements'] += [
      '#type' => 'container',
      '#prefix' => '<div id="type-dependent-set" >',
      '#suffix' => '</div>',
    ];

    return $form;
  }