public function CountryMappingEditForm::buildForm in Flags 8
@inheritDoc
Overrides ConfigEntityFormBase::buildForm
File
- flags_ui/
src/ Form/ CountryMappingEditForm.php, line 41  
Class
- CountryMappingEditForm
 - Class CountryMappingEditForm
 
Namespace
Drupal\flags_ui\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
  /** @var FlagMapping $mapping */
  $mapping = $this->entity;
  // Unfortunately countries are indexed with uppercase letters
  // se we make sure our ids are correct.
  $id = strtoupper($mapping
    ->getSource());
  $form['title'] = [
    '#type' => 'item',
    '#markup' => isset($this->countries[$id]) ? $this->countries[$id] : $id,
  ];
  $form = parent::buildForm($form, $form_state);
  // Once created, source can not be edited.
  $form['source'] = [
    '#type' => 'value',
    '#value' => $mapping
      ->getSource(),
  ];
  return $form;
}