You are here

function course_object_custom_fields in Course 6

Get an array of custom course object fields.

Return value

array An array of custom course object fields, in the format key => value.

1 string reference to 'course_object_custom_fields'
course_settings_objects_form in includes/course.settings.inc
Course objects settings handler callback.

File

includes/course.settings.inc, line 119
Administrative settings for Course module.

Code

function course_object_custom_fields() {
  $fields = array();
  $list = explode("\n", variable_get('course_object_custom_fields', ''));
  $list = array_map('trim', $list);
  $list = array_filter($list, 'strlen');
  foreach ($list as $opt) {

    // Sanitize the user input with a permissive filter.
    $opt = content_filter_xss($opt);
    if (strpos($opt, '|') !== FALSE) {
      list($key, $value) = explode('|', $opt);
      $fields[$key] = isset($value) && $value !== '' ? $value : $key;
    }
    else {
      $fields[$key] = $opt;
    }
  }
  return $fields;
}