You are here

public function CourseAppearanceSettingsForm::buildForm in Course 8.2

Same name and namespace in other branches
  1. 8.3 src/Form/CourseAppearanceSettingsForm.php \Drupal\course\Form\CourseAppearanceSettingsForm::buildForm()
  2. 3.x src/Form/CourseAppearanceSettingsForm.php \Drupal\course\Form\CourseAppearanceSettingsForm::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/CourseAppearanceSettingsForm.php, line 24

Class

CourseAppearanceSettingsForm
Class CourseSettingsAppearanceForm.

Namespace

Drupal\course\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('course.settings.appearance');
  $form['take_tab_display'] = array(
    '#title' => t('Show a "take course" tab on course nodes'),
    '#type' => 'checkbox',
    '#default_value' => $config
      ->get('take_tab_display'),
  );
  $theme = \Drupal::service('theme_handler')
    ->getDefault();
  $form['disable_regions'] = array(
    '#title' => t('Disable theme regions when taking a course'),
    '#type' => 'checkboxes',
    '#default_value' => $config
      ->get('disable_regions'),
    '#options' => system_region_list($theme),
  );
  return parent::buildForm($form, $form_state);
}