You are here

public static function FeedsDataHandler::instance in Feeds 6

Instantiate a FeedsDataHandler object. We implement our own instantiator method because DataHandler::instance() does not support a $key parameter.

Parameters

$table: The name of the table to access with this DataHandler object.

$key: The key that joins other tables.

Overrides DataHandler::instance

1 call to FeedsDataHandler::instance()
FeedsDataProcessor::handler in plugins/FeedsDataProcessor.inc
Return a data handler for this table.

File

includes/FeedsDataHandler.inc, line 67
Data handler used in FeedsDataProcessor.

Class

FeedsDataHandler
Simple multidimensional data handler. Treats tables that join to this handler's table through FeedsDatahandler::key as a cluster. Records in this cluster are regarded as belonging to one multidimensional data set joined by FeedsDatahandler::key.

Code

public static function instance($table, $key) {
  static $handlers;
  if (!isset($handlers[$table][$key])) {
    $class = 'FeedsDataHandler';

    // @todo This is an undocumented stop gap until Data module supports
    // handler plugins.
    if ($info = variable_get($table . '_handler', NULL)) {
      $class = $info['class'];
      include_once drupal_get_path('module', $info['module']) . '/' . $info['file'];
    }
    $handlers[$table][$key] = new $class($table, $key);
  }
  return $handlers[$table][$key];
}