You are here

function opigno_breadcrumbs_get_classes_from_course in Opigno 7

Helper function that return the classes linked to this course.

1 call to opigno_breadcrumbs_get_classes_from_course()
opigno_breadcrumbs in modules/breadcrumbs/opigno_breadcrumbs.module
Get the breadcrumb trail for the current page.

File

modules/breadcrumbs/opigno_breadcrumbs.module, line 91
Breadcrumbs module definition.

Code

function opigno_breadcrumbs_get_classes_from_course($course_nid) {
  $query = db_select('field_data_opigno_class_courses', 't')
    ->condition(db_and()
    ->condition('opigno_class_courses_target_id', $course_nid, '=')
    ->condition('bundle', 'class', '='))
    ->fields('t', array(
    'entity_id',
  ))
    ->execute();
  $classes_ids = array();
  while ($row = $query
    ->fetchAssoc()) {
    $classes_ids[$row['entity_id']] = $row['entity_id'];
  }
  return $classes_ids;
}