You are here

function panels_panels_include_directory in Panels 5.2

Same name and namespace in other branches
  1. 6.2 includes/plugins.inc \panels_panels_include_directory()

Implementation of hook_panels_include_directory().

This simple implementation of hook_panels_include_directory() is sufficient to mark all seven of the Panels subdirectories corresponding to the different plugin types as plugin directories that the Panels engine will search for plugins of that type when a request for those plugins are made.

It is important that separate directories be defined for each of the plugin types. While failure to separate the plugin directories should not result in an error, it will undermine the Panels engine's lazy-loading logic and negatively impact memory usage.

Note also that including a conditional on the plugin type so that you only define plugins for directories that you have actually populated with plugin include files is another small contribution to performance that you can make. For example, if you define only content_type and context plugins and don't want them at the root level of your module directory, this code would work:

function MYMODULE_panels_include_directory($plugin_type) {
  if ($plugin_type == 'content_types' || $plugin_type == 'contexts') {
    return 'panels_inc/' . $plugin_type;
  }
}

Parameters

string $plugin_type: The plugin type for which the Panels engine is currently requesting the location of an include directory.

Return value

string The location of the include directory for plugin type being requested, relative to the base directory of the module implementing this hook.

See also

panels_get_include_directories()

File

includes/plugins.inc, line 1425
plugins.inc

Code

function panels_panels_include_directory($plugin_type) {
  return $plugin_type;
}