You are here

function panels_get_include_directories in Panels 5.2

Invocation of panels_include_directory(), part of the main panels API.

This hook allows other modules to create their own panels .inc files according to the same filename and directory schema utilized by Panels itself, or some other arbitrary schema defined in implementations of the hook. Essentially, instead of having to declare all all callback definitions for a given plugin in a single hook implementation specific to that plugin calling this hook allows the caller to define a directory where Panels will then look for .inc files with callback declarations that conform to the naming scheme. The net result is the same, but implementing this hook does allow for better organization and flexibility in your .inc files, which is particularly preferable if you're implementing a lot of them.

PLEASE NOTE: There are strict naming conventions on implementing this hook; failure to follow the conventions will likely cause your plugins not to work. Possibly even worse, failure to follow the conventions can result in namespace collisions between your module and other modules invoking the panels API.


string $plugintype: The type of Panels plugin being requested. Can be any of the following seven: 'content_types', 'contexts', 'arguments', 'layouts', 'styles', 'relationships', 'cache', 'switchers'

Return value

array $directories Returns an array of include subdirectories to call for the requested plugin type. Subdirectories should be ONLY the subdirectory of your module where the appropriate types of .inc files reside.

See also


1 call to panels_get_include_directories()
panels_load_includes in includes/
Load plugins from a directory.


includes/, line 1379


function panels_get_include_directories($plugin_type) {
  $directories = array();
  foreach (module_implements('panels_include_directory') as $module) {
    $result = module_invoke($module, 'panels_include_directory', $plugin_type);
    if (isset($result) && is_string($result)) {
      $directories[$module] = drupal_get_path('module', $module) . '/' . $result;
  return $directories;