You are here

function course_form_field_config_edit_form_alter in Course 3.x

Same name and namespace in other branches
  1. 8.3 course.module \course_form_field_config_edit_form_alter()
  2. 8.2 course.module \course_form_field_config_edit_form_alter()

Implements hook_form_FORM_ID_alter().

File

./course.module, line 862
course.module Core functionality for Courses.

Code

function course_form_field_config_edit_form_alter(&$form, FormStateInterface $form_state) {
  $field = $form_state
    ->getFormObject()
    ->getEntity();
  if ($field
    ->getTargetEntityTypeId() != 'course_enrollment') {
    return;
  }
  $form['third_party_settings']['course']['show_field'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show this field on enrollment.'),
    '#default_value' => $field
      ->getThirdPartySetting('course', 'show_field', TRUE),
    '#description' => t('If checked, this field will be presented when starting a course.'),
  );
}