You are here

reference_table_formatter.module in Reference Table Formatter 7

Format reference fields as tables of information.

File

reference_table_formatter.module
View source
<?php

/**
 * @file
 * Format reference fields as tables of information.
 */

// No hook_hook_info is provided by the field API. Organise hooks anyway.
require_once 'reference_table_formatter.field.inc';
require_once 'reference_table_formatter_base_type.inc';

/**
 * Implements hook_ctools_plugin_type().
 */
function reference_table_formatter_ctools_plugin_type() {
  $plugins['reference_types'] = array(
    'classes' => array(
      'handler',
    ),
  );
  return $plugins;
}

/**
 * Load a "reference type" plugin.
 *
 * @param $id
 *   The plugin ID to load.
 * @param $field
 *   The field definition.
 * @param $instance
 *   The field instance.
 * @param $settings
 *   The settings array from the field API.
 *
 * @return object
 *   A loaded plugin.
 */
function reference_table_formatter_load_plugin($id, $field, $instance, $settings) {
  ctools_include('plugins');
  $plugin = ctools_get_plugins('reference_table_formatter', 'reference_types', $id);
  $class = ctools_plugin_get_class($plugin, 'handler');
  return new $class($field, $instance, $settings);
}

/**
 * Load all of the reference type plugins.
 *
 * @return array
 */
function reference_table_formatter_load_plugins() {
  ctools_include('plugins');
  return ctools_get_plugins('reference_table_formatter', 'reference_types');
}

/**
 * Implements hook_ctools_plugin_directory().
 */
function reference_table_formatter_ctools_plugin_directory($owner, $plugin_type) {
  return 'plugins/' . $plugin_type;
}