public function EntityUpdateTestSettings::buildForm in Entity Update 8
Same name and namespace in other branches
- 2.0.x tests/modules/entity_update_tests/src/Form/EntityUpdateTestSettings.php \Drupal\entity_update_tests\Form\EntityUpdateTestSettings::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 FormInterface::buildForm
File
- modules/
entity_update_tests/ src/ Form/ EntityUpdateTestSettings.php, line 33
Class
- EntityUpdateTestSettings
- Class CheckEntityUpdate.
Namespace
Drupal\entity_update_tests\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$link_help = '/admin/help/entity_update';
$form['messages']['about'] = [
'#type' => 'markup',
'#markup' => "<a href='{$link_help}'>Help page</a>.",
'#prefix' => '<div>',
'#suffix' => '</div>',
];
// Unstall / Uninstall fields.
$fields = self::getConfigurableFields('install');
foreach ($fields as $field_key => $field_name) {
$form['fields'][$field_key] = [
'#type' => 'checkbox',
'#title' => "Field : {$field_name}",
'#default_value' => EntityUpdateTestHelper::fieldStatus($field_key),
];
}
// Cha,nge field type.
$fields = self::getConfigurableFields('type');
foreach ($fields as $field_key => $field_name) {
$form['fields'][$field_key] = [
'#type' => 'select',
'#options' => [
'string' => 'String',
'integer' => 'Integer',
],
'#title' => "Field : {$field_name}",
'#default_value' => EntityUpdateTestHelper::fieldStatus($field_key),
];
}
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Save'),
];
return $form;
}