You are here

public function AdminSettingsForm::buildForm in Entity Share 8.3

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

modules/entity_share_diff/src/Form/AdminSettingsForm.php, line 39

Class

AdminSettingsForm
Configure Entity share diff on this site.

Namespace

Drupal\entity_share_diff\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config(static::SETTINGS);
  $form['#tree'] = TRUE;
  $form['context'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Output'),
    '#description' => $this
      ->t('Configure the look and feel of the diff.<br />It is preferable to have a bigger number of context lines in order to better display the nested differences.'),
    '#open' => TRUE,
  ];
  $form['context']['lines_leading'] = [
    '#type' => 'number',
    '#min' => 1,
    '#max' => 1000,
    '#size' => 5,
    '#title' => $this
      ->t('Leading lines'),
    '#description' => $this
      ->t('The number of lines of leading context before each difference.'),
    '#default_value' => $config
      ->get('context.lines_leading'),
  ];
  $form['context']['lines_trailing'] = [
    '#type' => 'number',
    '#min' => 1,
    '#max' => 1000,
    '#size' => 5,
    '#title' => $this
      ->t('Trailing lines'),
    '#description' => $this
      ->t('The number of lines of trailing context after each difference.'),
    '#default_value' => $config
      ->get('context.lines_trailing'),
  ];
  return parent::buildForm($form, $form_state);
}