You are here

function _panels_process_plugin in Panels 5.2

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

Process a single hook implementation of a panels plugin.

Parameters

$module: The module that owns the hook.

$identifier: Either the module or 'panels_' . $file->name

$hook: The name of the hook being invoked.

2 calls to _panels_process_plugin()
panels_load_hooks in includes/plugins.inc
Load plugin info for the provided hook; this is handled separately from plugins from files.
panels_load_includes in includes/plugins.inc
Load plugins from a directory.

File

includes/plugins.inc, line 1472
plugins.inc

Code

function _panels_process_plugin($module, $identifier, $path, $hook) {
  $function = $identifier . '_' . $hook;
  if (!function_exists($function)) {
    return NULL;
  }
  $result = $function();
  if (!isset($result) || !is_array($result)) {
    return NULL;
  }

  // Fill in defaults.
  foreach ($result as $name => $plugin) {
    $result[$name]['module'] = $module;
    $result[$name]['name'] = $name;
    $result[$name]['path'] = $path;

    // Add some content type-specific defaults, but allow them to be overridden by declarations in the content type.
    if (preg_match('/content_type/', $hook)) {
      $result[$name] = array_merge(array(
        'single' => FALSE,
        'visibility serialize' => FALSE,
        'role-based access' => TRUE,
      ), $result[$name]);
    }
  }
  return $result;
}