You are here

public function CourseUbercartSettingsForm::buildForm in Course 3.x

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

modules/course_uc/src/Form/CourseUbercartSettingsForm.php, line 13

Class

CourseUbercartSettingsForm
Ubercart course settings form.

Namespace

Drupal\course_uc\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('course_uc.settings');
  $form['bypass_checkout'] = array(
    '#title' => 'Bypass checkout for free course products.',
    '#description' => 'Users will not have to go through checkout for course products that are free.',
    '#type' => 'checkbox',
    '#default_value' => $config
      ->get('bypass_checkout', TRUE),
  );
  $form['restrict_qty'] = array(
    '#title' => 'Restrict course products to 1 per customer.',
    '#description' => 'Course will restrict users from adding the product to cart if they have already purchased the course or already have the course in their cart.',
    '#type' => 'checkbox',
    '#default_value' => $config
      ->get('restrict_qty', TRUE),
  );
  return parent::buildForm($form, $form_state);
}