You are here

function _advanced_forum_process_plugin in Advanced Forum 6.2

Same name and namespace in other branches
  1. 6 advf-plugins.inc \_advanced_forum_process_plugin()
  2. 7.2 includes/plugins.inc \_advanced_forum_process_plugin()

Process a single hook implementation of a advanced_forum plugin.

Parameters

$module: The module that owns the hook.

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

$hook: The name of the hook being invoked.

1 call to _advanced_forum_process_plugin()
advanced_forum_load_hooks in includes/plugins.inc
Load plugin info for all hooks; this is handled separately from plugins from files.

File

includes/plugins.inc, line 104
Allows modules to contribute styles.

Code

function _advanced_forum_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) {
    if (!is_dir($path . '/' . $plugin['directory'])) {
      unset($result[$name]);
      continue;
    }
    $result[$name] += array(
      'module' => $module,
      'name' => $name,
      'path' => $path . '/' . $plugin['directory'],
    );
  }
  return !empty($result) ? $result : NULL;
}