function course_get_handlers in Course 6
Same name and namespace in other branches
- 8.3 course.module \course_get_handlers()
- 8.2 course.module \course_get_handlers()
- 7.2 course.module \course_get_handlers()
- 7 course.module \course_get_handlers()
- 3.x course.module \course_get_handlers()
Get course handlers.
Parameters
string $type: (optional) The course handler type to return. If no type is specified, all types are returned.
Return value
array A merged, structured array of course handlers, optionally limited by type.
array An array of hook implementations keyed by module name, containing:
- A single handler type definition, if the $type parameter is passed.
- Or an associative array of all course handler definitions keyed by type.
12 calls to course_get_handlers()
- CourseObject::getTitle in includes/
course_object.core.inc - CourseObjectContentTestCase::testContentCourseObjectCreation in modules/
course_content/ course_content.test - Test course content object creation.
- CourseTestCase::setUp in tests/
CourseTestCase.test - Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
- course_cron in ./
course.module - Implements hook_cron().
- course_form_alter in ./
course.module - Implements hook_form_alter().
File
- ./
course.module, line 320 - course.module Core functionality for Courses.
Code
function course_get_handlers($type = NULL, $flush = FALSE) {
static $all = array();
if (!$all || $flush) {
// Allow modules to define handlers that extend Course functionality.
// Do not use module_invoke_all() here because we need to know which module
// is providing the 'object' handler type. This is to avoid namespace
// conflicts between multiple modules providing a 'quiz' object for example.
$hook = 'course_handlers';
foreach (module_implements($hook) as $module) {
$function = $module . '_' . $hook;
$handlers = $function();
// Allow modules to alter each other's list of handlers.
drupal_alter($hook, $handlers, $module);
if (isset($handlers) && is_array($handlers)) {
$all[$module] = $handlers;
}
}
}
if (isset($type)) {
// Loop through each module's result again, and rebuild the array including
// only the specified handler type. We do this again so we can static cache
// the hook invocation and function calls above.
$filtered = array();
foreach ($all as $module => $handlers) {
if (isset($handlers[$type])) {
$filtered[$module] = $handlers[$type];
}
}
// Return the keyed array of implementations, each filtered to include only
// the specified handler type definition.
return $filtered;
}
else {
// Return the keyed array of all implementations.
return $all;
}
}