public function SettingsForm::buildForm in Lightning Layout 8
Same name and namespace in other branches
- 8.2 src/Form/SettingsForm.php \Drupal\lightning_layout\Form\SettingsForm::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/ SettingsForm.php, line 114
Class
- SettingsForm
- The settings form for controlling Lightning Layout's behavior.
Namespace
Drupal\lightning_layout\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['entity_blocks'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Entity types to expose as blocks'),
'#default_value' => $this
->config('lightning_layout.settings')
->get('entity_blocks'),
];
// Get the definitions of all entity types supported by Entity Block.
/** @var \Drupal\Core\Entity\EntityTypeInterface[] $available_types */
$available_types = array_intersect_key($this->entityTypeManager
->getDefinitions(), $this->deriver
->getDerivativeDefinitions([]));
foreach ($available_types as $id => $entity_type) {
$form['entity_blocks']['#options'][$id] = $entity_type
->getLabel();
}
return parent::buildForm($form, $form_state);
}