public function ClassesForm::buildForm in Display Suite 8.2
Same name and namespace in other branches
- 8.4 src/Form/ClassesForm.php \Drupal\ds\Form\ClassesForm::buildForm()
- 8.3 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\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('ds.settings');
$form['regions'] = array(
'#type' => 'textarea',
'#title' => $this
->t('CSS classes for regions'),
'#default_value' => implode("\n", $config
->get('classes.region')),
'#description' => $this
->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>'),
);
// Only show field classes if DS extras module is enabled.
if (\Drupal::moduleHandler()
->moduleExists('ds_extras')) {
$form['fields'] = array(
'#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);
}