You are here

public function EdgeEntityAliasConfigFormBase::buildForm in Apigee Edge 8

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

src/Form/EdgeEntityAliasConfigFormBase.php, line 34

Class

EdgeEntityAliasConfigFormBase
Base form for those Apigee Edge entities that supports aliasing.

Namespace

Drupal\apigee_edge\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config($this
    ->getConfigNameWithLabels());
  $form['label'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('How to refer to a @entity_type on the UI', [
      '@entity_type' => $this
        ->entityTypeName(),
    ]),
    '#collapsible' => FALSE,
  ];
  $form['label']['entity_label_singular'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Singular format'),
    '#default_value' => $config
      ->get('entity_label_singular'),
    '#description' => $this
      ->t('Leave empty to use the default "@singular_label" label.', [
      '@singular_label' => $this
        ->originalSingularLabel(),
    ]),
  ];
  $form['label']['entity_label_plural'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Plural format'),
    '#default_value' => $config
      ->get('entity_label_plural'),
    '#description' => $this
      ->t('Leave empty to use the default "@plural_label" label.', [
      '@plural_label' => $this
        ->originalPluralLabel(),
    ]),
  ];
  return parent::buildForm($form, $form_state);
}