You are here

function panels_get_directories in Panels 6.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.

Parameters

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

panels_panels_include_directory()

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

File

includes/plugins.inc, line 1392
plugins.inc

Code

function panels_get_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;
}