You are here

function template_preprocess_course in Course 3.x

Prepares variables for course templates.

Default template: course.html.twig.

Parameters

array $variables: An associative array containing:

  • elements: An associative array containing rendered fields.
  • attributes: HTML attributes for the containing element.

File

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

Code

function template_preprocess_course(array &$variables) {

  /** @var Course $course */
  $course = $variables['elements']['#course'];
  $variables['course'] = $course;

  // Helpful $content variable for templates.
  $variables['content'] = [];
  foreach (Element::children($variables['elements']) as $key) {
    $variables['content'][$key] = $variables['elements'][$key];
  }
}