function views_include_handler
Attempt to find the include file for a given handler from its definition.
This will also attempt to include all parents, though we're maxing the parent chain to 10 to prevent infinite loops.
2 calls to views_include_handler()
- views_plugin_display::construct in plugins/
views_plugin_display.inc - Views handlers use a special construct function so that we can more easily construct them with variable arguments.
- _views_create_handler in includes/
handlers.inc - Instantiate and construct a new handler
File
-
includes/
handlers.inc, line 56
Code
function views_include_handler($handler, $definition, $type, $count = 0) {
// Do not proceed if the class already exists.
if (isset($handler) && class_exists($handler, FALSE)) {
return TRUE;
}
// simple infinite loop prevention.
if ($count > 10) {
vpr(t('Handler @handler include tried to loop infinitely!', array(
'@handler' => $handler,
)));
return FALSE;
}
if (!isset($definition['path'])) {
if ($type == 'handler') {
$definition += views_fetch_handler_data($handler);
}
else {
$definition += views_fetch_plugin_data($type, $handler);
}
}
if (!empty($definition['parent'])) {
if ($type == 'handler') {
$parent = views_fetch_handler_data($definition['parent']);
}
else {
$parent = views_fetch_plugin_data($type, $definition['parent']);
}
if ($parent) {
$rc = views_include_handler($parent['handler'], $parent, $type, $count + 1);
// If the parent chain cannot be included, don't try; this will
// help alleviate problems with modules with cross dependencies.
if (!$rc) {
return FALSE;
}
}
}
if (isset($definition['path']) && $definition['file']) {
$filename = './' . $definition['path'] . '/' . $definition['file'];
if (file_exists($filename)) {
require_once $filename;
}
}
return class_exists($handler, FALSE);
}