public function OpignoModuleSettingsForm::buildForm in Opigno module 8
Same name and namespace in other branches
- 3.x src/Form/OpignoModuleSettingsForm.php \Drupal\opigno_module\Form\OpignoModuleSettingsForm::buildForm()
Defines the settings form for Module entities.
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 Form definition array.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ OpignoModuleSettingsForm.php, line 65
Class
- OpignoModuleSettingsForm
- Class OpignoModuleSettingsForm.
Namespace
Drupal\opigno_module\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['OpignoModule_settings']['#markup'] = 'Settings form for Module entities. Manage field settings here.';
$config = $this
->config('opigno_module.settings');
$form['description'] = [
'#type' => 'textarea',
'#title' => $this
->t('Description'),
'#default_value' => $config
->get('description'),
];
$form['availability_options'] = array(
'#type' => 'fieldset',
'#title' => $this
->t('Availability options'),
);
$form['availability_options']['availability_closed_message'] = array(
'#type' => 'textarea',
'#title' => $this
->t('Module closed message'),
'#default_value' => $config
->get('availability_closed_message'),
);
$form['availability_options']['availability_unavailable_message'] = array(
'#type' => 'textarea',
'#title' => $this
->t('Module not yet opened message'),
'#default_value' => $config
->get('availability_unavailable_message'),
);
if (\Drupal::moduleHandler()
->moduleExists('token')) {
$form['availability_options']['token_tree'] = [
'#theme' => 'token_tree_link',
'#show_restricted' => TRUE,
'#token_types' => array(
'opigno_module',
),
];
}
$form['availability_options'] = array(
'#type' => 'fieldset',
'#title' => $this
->t('Availability options'),
);
$form['availability_options']['availability_closed_message'] = array(
'#type' => 'textarea',
'#title' => $this
->t('Module closed message'),
'#default_value' => $config
->get('availability_closed_message'),
);
$form['availability_options']['availability_unavailable_message'] = array(
'#type' => 'textarea',
'#title' => $this
->t('Module not yet opened message'),
'#default_value' => $config
->get('availability_unavailable_message'),
);
if (\Drupal::moduleHandler()
->moduleExists('token')) {
$form['availability_options']['token_tree'] = [
'#theme' => 'token_tree_link',
'#show_restricted' => TRUE,
'#token_types' => array(
'opigno_module',
),
];
}
return parent::buildForm($form, $form_state);
}