function views_get_handler
Same name in other branches
- 7.x-3.x views.module \views_get_handler()
Fetch a handler from the data cache.
Parameters
$table: The name of the table this handler is from.
$field: The name of the field this handler is from.
$key: The type of handler. i.e, sort, field, argument, filter, relationship
$override: Override the actual handler object with this class. Used for aggregation when the handler is redirected to the aggregation handler.
Return value
views_handler An instance of a handler object. May be views_handler_broken.
14 calls to views_get_handler()
- views1_import in includes/
convert.inc - Convert a Views 1 view to a Views 2 view.
- views_db_object::add_item in includes/
view.inc - Add an item with a handler to the view.
- views_handler_field_group_by_numeric::init in handlers/
views_handler_field_group_by_numeric.inc - init the handler with necessary data.
- views_handler_sort_group_by_numeric::init in handlers/
views_handler_sort_group_by_numeric.inc - init the handler with necessary data.
- views_plugin_display::export_handler in plugins/
views_plugin_display.inc - Special method to export items that have handlers.
File
-
./
views.module, line 861
Code
function views_get_handler($table, $field, $key, $override = NULL) {
$data = views_fetch_data($table);
$handler = NULL;
views_include('handlers');
if (isset($data[$field][$key])) {
// Set up a default handler:
if (empty($data[$field][$key]['handler'])) {
$data[$field][$key]['handler'] = 'views_handler_' . $key;
}
if ($override) {
$data[$field][$key]['override handler'] = $override;
}
$handler = _views_prepare_handler($data[$field][$key], $data, $field, $key);
}
if ($handler) {
return $handler;
}
vpr("Missing handler: {$table} {$field} {$key}");
$broken = array(
'title' => t('Broken handler @table.@field', array(
'@table' => $table,
'@field' => $field,
)),
'handler' => 'views_handler_' . $key . '_broken',
'table' => $table,
'field' => $field,
);
return _views_create_handler($broken, 'handler', $key);
}