You are here

function ctools_include in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 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.

171 calls to ctools_include()
bulk_export_export in bulk_export/bulk_export.module
FAPI gateway to the bulk exporter.
ctools_access_admin_form in includes/context-access-admin.inc
Administrative form for access control.
ctools_access_admin_render_table in includes/context-access-admin.inc
Render the table. This is used both to render it initially and to rerender it upon ajax response.
ctools_access_ajax_add in includes/context-access-admin.inc
AJAX callback to add a new access test to the list.
ctools_access_ajax_delete in includes/context-access-admin.inc
AJAX command to remove an access control item.

... See full list

File

./ctools.module, line 107
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_get_path('module', $module) . "{$dir}{$file}.inc";
    $used[$module][$dir][$file] = true;
  }
}