public function CourseObjectSettingsForm::buildForm in Course 3.x
Same name and namespace in other branches
- 8.3 src/Form/CourseObjectSettingsForm.php \Drupal\course\Form\CourseObjectSettingsForm::buildForm()
- 8.2 src/Form/CourseObjectSettingsForm.php \Drupal\course\Form\CourseObjectSettingsForm::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/ CourseObjectSettingsForm.php, line 24
Class
- CourseObjectSettingsForm
- Class CourseObjectSettingsForm.
Namespace
Drupal\course\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('course.settings.object');
$form['header']['#markup'] = '<p>' . t('Here, you can manage the settings related to course objects.') . '</p>';
$form['header']['#markup'] .= '<p>' . t('Fields added to the course object entity are included on the course object editing form, and may be used in course object theme hooks.') . '</p>';
foreach (user_roles() as $role) {
$roles[$role
->id()] = $role
->label();
}
$form['private_roles'] = array(
'#title' => 'Default roles allowed access',
'#description' => t('By default, when a private course object is created, all view access is revoked. Set roles here that will have access to view private course objects without having access.'),
'#type' => 'checkboxes',
'#default_value' => $config
->get('private_roles'),
'#options' => $roles,
);
return parent::buildForm($form, $form_state);
}