You are here

public function ClassesForm::buildForm in Display Suite 8.3

Same name and namespace in other branches
  1. 8.4 src/Form/ClassesForm.php \Drupal\ds\Form\ClassesForm::buildForm()
  2. 8.2 src/Form/ClassesForm.php \Drupal\ds\Form\ClassesForm::buildForm()

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/ClassesForm.php, line 23

Class

ClassesForm
Configures classes used by wrappers and regions.

Namespace

Drupal\ds\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('ds.settings');
  $form['regions'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('CSS classes for regions'),
    '#default_value' => implode("\n", $config
      ->get('classes.region')),
    '#description' => t('Configure CSS classes which you can add to regions on the "manage display" screens. Add multiple CSS classes line by line.<br />If you want to have a friendly name, separate class and friendly name by |, but this is not required. eg:<br /><em>class_name_1<br />class_name_2|Friendly name<br />class_name_3</em>'),
  ];
  $form['fields'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('CSS classes for fields'),
    '#default_value' => implode("\n", $config
      ->get('classes.field')),
    '#description' => $this
      ->t('Configure CSS classes which you can add to fields on the "manage display" screens. Add multiple CSS classes line by line.<br />If you want to have a friendly name, separate class and friendly name by |, but this is not required. eg:<br /><em>class_name_1<br />class_name_2|Friendly name<br />class_name_3</em>'),
  ];
  return parent::buildForm($form, $form_state);
}