public function LayoutParagraphsSettingsForm::buildForm in Layout Paragraphs 1.0.x
Same name and namespace in other branches
- 2.0.x src/Form/LayoutParagraphsSettingsForm.php \Drupal\layout_paragraphs\Form\LayoutParagraphsSettingsForm::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/ LayoutParagraphsSettingsForm.php, line 68
Class
- LayoutParagraphsSettingsForm
- Class LayoutParagraphsSettingsForm.
Namespace
Drupal\layout_paragraphs\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$lp_config = $this
->configFactory()
->getEditable('layout_paragraphs.settings');
$lp_config_schema = $this->typedConfigManager
->getDefinition('layout_paragraphs.settings') + [
'mapping' => [],
];
$lp_config_schema = $lp_config_schema['mapping'];
$form['show_paragraph_labels'] = [
'#type' => 'checkbox',
'#title' => $lp_config_schema['show_paragraph_labels']['label'],
'#description' => $lp_config_schema['show_paragraph_labels']['description'],
'#default_value' => $lp_config
->get('show_paragraph_labels'),
];
$form['show_layout_labels'] = [
'#type' => 'checkbox',
'#title' => $lp_config_schema['show_layout_labels']['label'],
'#description' => $lp_config_schema['show_layout_labels']['description'],
'#default_value' => $lp_config
->get('show_layout_labels'),
];
return parent::buildForm($form, $form_state);
}