public function Settings::buildForm in Entity Update 2.0.x
Same name and namespace in other branches
- 8 src/Form/Settings.php \Drupal\entity_update\Form\Settings::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/ Settings.php, line 31
Class
- Settings
- Entity update settings form.
Namespace
Drupal\entity_update\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config(EntityUpdateHelper::getConfigName());
$items_list = entity_update_get_entity_definitions();
$options = [];
foreach ($items_list as $key => $item) {
$group = $item
->getGroup();
$label = $item
->getLabel();
$options[$key] = $label . " ({$group})";
}
$form['excludes'] = [
'#type' => 'checkboxes',
'#title' => 'Entity types to exclude',
'#description' => $this
->t('Selected entity types are exclude from deletation and recreation.'),
'#options' => $options,
'#default_value' => $config
->get('excludes'),
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => "Save Settings",
];
return $form;
}