public function SettingsForm::buildForm in Entity Reference Integrity 8
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_reference_integrity_enforce/ src/ Form/ SettingsForm.php, line 57
Class
- SettingsForm
- The settings form for entity_reference_integrity.
Namespace
Drupal\entity_reference_integrity_enforce\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$options = [];
foreach ($this->entityTypeDefinitions as $definition) {
$options[$definition
->id()] = $definition
->getLabel() ?: $definition
->id();
}
uasort($options, 'strcasecmp');
$form['intro'] = [
'#prefix' => '<p>',
'#markup' => $this
->t('Select the entity types which, when referenced will be prevented from being deleted.'),
'#suffix' => '</p>',
];
$form['enabled_entity_type_ids'] = [
'#title' => $this
->t('Enabled Entities'),
'#type' => 'checkboxes',
'#multiple' => TRUE,
'#options' => $options,
'#default_value' => $this
->config('entity_reference_integrity_enforce.settings')
->get('enabled_entity_type_ids'),
];
return parent::buildForm($form, $form_state);
}