You are here

tamper.module in Tamper 7

A generic framework for modifying data.

File

tamper.module
View source
<?php

/**
 * @file
 * A generic framework for modifying data.
 */

/**
 * Implements hook_ctools_plugin_type().
 */
function tamper_ctools_plugin_type() {
  return array(
    'plugins' => array(
      'use hooks' => FALSE,
      'cache' => TRUE,
      'defaults' => array(
        'compatible' => array(),
      ),
      'classes' => array(
        'class',
      ),
      'process' => '_tamper_process_plugin_definition',
    ),
  );
}

/**
 * Processes ctools plugin definitions.
 *
 * If the class definition is a string, we assume the class lives in the src
 * directory.
 */
function _tamper_process_plugin_definition(array &$definition) {
  if (!is_string($definition['class'])) {
    return;
  }
  $definition['class'] = array(
    'class' => $definition['class'],
    'file' => $definition['class'] . '.php',
    'path' => drupal_get_path('module', $definition['module']) . '/src/Plugins',
  );
}

/**
 * Implements hook_ctools_plugin_api().
 */
function tamper_ctools_plugin_api($owner, $api) {
  if ($owner === 'tamper' && $api === 'plugins') {
    return array(
      'version' => 1,
    );
  }
}

/**
 * Implements hook_ctools_plugin_directory().
 */
function tamper_ctools_plugin_directory($module, $plugin) {
  if ($module === 'tamper') {
    return 'plugins';
  }
}