function views_get_handler

cis7 views.module views_get_handler($table, $field, $key, $override = NULL)
cle7 views.module views_get_handler($table, $field, $key, $override = NULL)
elmsmedia7 views.module views_get_handler($table, $field, $key, $override = NULL)
icor7 views.module views_get_handler($table, $field, $key, $override = NULL)
meedjum_blog7 views.module views_get_handler($table, $field, $key, $override = NULL)
mooc7 views.module views_get_handler($table, $field, $key, $override = NULL)

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.

15 calls to views_get_handler()
better_exposed_filters_exposed_form_plugin::pre_render in sites/all/modules/ulmus/better_exposed_filters/better_exposed_filters_exposed_form_plugin.inc
Pre render callback to append the 'no values found' text if input required options is enabled.
views_db_object::add_item in sites/all/modules/ulmus/views/includes/view.inc
Add an item with a handler to the view.
views_handler_sort_group_by_numeric::init in sites/all/modules/ulmus/views/handlers/views_handler_sort_group_by_numeric.inc
views_plugin_display::export_handler in sites/all/modules/ulmus/views/plugins/views_plugin_display.inc
Special method to export items that have handlers.
views_plugin_display::get_handlers in sites/all/modules/ulmus/views/plugins/views_plugin_display.inc
Get a full array of handlers for $type. This caches them.

... See full list

File

sites/all/modules/ulmus/views/views.module, line 1170
Primarily Drupal hooks and global API functions to manipulate views.

Code

function views_get_handler($table, $field, $key, $override = NULL) {
  static $recursion_protection = array();

  $data = views_fetch_data($table, FALSE);
  $handler = NULL;
  views_include('handlers');

  // Support old views_data entries conversion.

  // Support conversion on table level.
  if (isset($data['moved to'])) {
    $moved = array($data['moved to'], $field);
  }
  // Support conversion on datafield level.
  if (isset($data[$field]['moved to'])) {
    $moved = $data[$field]['moved to'];
  }
  // Support conversion on handler level.
  if (isset($data[$field][$key]['moved to'])) {
    $moved = $data[$field][$key]['moved to'];
  }

  if (isset($data[$field][$key]) || !empty($moved)) {
    if (!empty($moved)) {
      list($moved_table, $moved_field) = $moved;
      if (!empty($recursion_protection[$moved_table][$moved_field])) {
        // recursion detected!
        return NULL;
      }

      $recursion_protection[$moved_table][$moved_field] = TRUE;
      $handler = views_get_handler($moved_table, $moved_field, $key, $override);
      $recursion_protection = array();
      if ($handler) {
        // store these values so we know what we were originally called.
        $handler->original_table = $table;
        $handler->original_field = $field;
        if (empty($handler->actual_table)) {
          $handler->actual_table = $moved_table;
          $handler->actual_field = $moved_field;
        }
      }
      return $handler;
    }

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

  // DEBUG -- identify missing handlers
  vpr("Missing handler: @table @field @key", array('@table' => $table, '@field' => $field, '@key' => $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);
}