You are here

function views_get_handler in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 8.3 views.module \views_get_handler()
  2. 6.2 views.module \views_get_handler()
  3. 7.3 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.

... See full list

File

./views.module, line 861
Primarily Drupal hooks and global API functions to manipulate views.

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);
}