You are here

function _diff_autoload in Diff 7.3

Private helper function to load field includes.

Parameters

array|string $field_or_module: The field definition array or the module that implements the field.

2 calls to _diff_autoload()
diff_entity_fields_diff in ./diff.diff.inc
Internal callback to handle fieldable entities.
_diff_field_default_settings in ./diff.diff.inc
Helper function to populate the settings array.

File

./diff.diff.inc, line 318
Includes the hooks defined by diff_hook_info().

Code

function _diff_autoload($field_or_module) {
  $includes =& drupal_static(__FUNCTION__, FALSE);
  if (!$includes) {
    $includes = array(
      'file' => module_exists('file'),
      'image' => module_exists('image'),
      'list' => module_exists('list'),
      'taxonomy' => module_exists('taxonomy'),
      'text' => module_exists('text'),
      'number' => module_exists('number'),
    );
  }
  $module = is_string($field_or_module) ? $field_or_module : $field_or_module['module'];

  // Since field hooks are not real hooks, we manually load the field modules
  // MODULE.diff.inc. We handle the five core field defining modules.
  if (!isset($includes[$module])) {
    module_load_include('diff.inc', $module);
    $includes[$module] = 0;
  }
  elseif (!empty($includes[$module])) {
    module_load_include('inc', 'diff', 'includes/' . $module);
    $includes[$module] = 0;
  }
}