You are here

function ctools_include in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 ctools.module \ctools_include()

Include .inc files as necessary.

This fuction is helpful for including .inc files for your module. The general case is including ctools funcitonality like this:

ctools_include('plugins');

Similar funcitonality can be used for other modules by providing the $module and $dir arguments like this:

// include mymodule/includes/import.inc
ctools_include('import', 'mymodule');

// include mymodule/plugins/foobar.inc
ctools_include('foobar', 'mymodule', 'plugins');

Parameters

$file: The base file name to be included.

$module: Optional module containing the include.

$dir: Optional subdirectory containing the include file.

199 calls to ctools_include()
bulk_export_export in bulk_export/bulk_export.module
FAPI gateway to the bulk exporter.
CtoolsContextIDTestCase::setUp in tests/context.test
Sets up a Drupal site for running functional and integration tests.
CtoolsContextKeywordsSubstitutionTestCase::setUp in tests/context.test
Sets up a Drupal site for running functional and integration tests.
CToolsCssCache::clear in includes/css-cache.inc
Expires data from the cache.
CtoolsCssTestCase::setUp in tests/css.test
Sets up a Drupal site for running functional and integration tests.

... See full list

File

./ctools.module, line 127
CTools primary module file.

Code

function ctools_include($file, $module = 'ctools', $dir = 'includes') {
  static $used = array();
  $dir = '/' . ($dir ? $dir . '/' : '');
  if (!isset($used[$module][$dir][$file])) {
    require_once DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . "{$dir}{$file}.inc";
    $used[$module][$dir][$file] = TRUE;
  }
}