You are here

function fusion_apply_get_group_info in Fusion Accelerator 7

Same name and namespace in other branches
  1. 7.2 fusion_apply/fusion_apply.module \fusion_apply_get_group_info()

Retrieves all skin groups registered by modules and themes.

Return value

An array of groups.

5 calls to fusion_apply_get_group_info()
FusionApplyApiTestCase::testFusionApplyGroupInfo in fusion_apply/tests/fusion_apply.test
Tests hook_fusion_apply_group_info().
fusion_apply_ui_admin_skin_infos in fusion_apply/fusion_apply_ui.admin.inc
Menu callback: skins administration.
fusion_apply_ui_admin_skin_info_settings in fusion_apply/fusion_apply_ui.admin.inc
Menu callback; displays a listing of all skins in a skinset, allowing you to enable or disable them individually for each theme.
fusion_apply_ui_form_alter in fusion_apply/fusion_apply_ui.module
Implements hook_form_alter().
fusion_apply_ui_form_validate in fusion_apply/fusion_apply_ui.module
Form validation handler for fusion_apply_ui_form_alter().

File

fusion_apply/fusion_apply.module, line 912
Handles core Fusion Apply functionality.

Code

function fusion_apply_get_group_info() {
  $group_info =& drupal_static(__FUNCTION__);
  if (!isset($group_info)) {
    if ($cached = cache_get('fusion_apply_group_info')) {
      $group_info = $cached->data;
      return $group_info;
    }
    $group_info = array();
    foreach (fusion_apply_implements() as $name => $extension) {
      $hooks = array(
        "{$name}_fusion_apply_group_info" => $extension,
      );

      // Load the extension's plugins, if any.
      if ($files = fusion_apply_load_plugins($extension)) {

        // The base path for plugins is the directory defined by the extension.
        $dir = $extension['path'] . '/' . $extension['directory'];
        foreach ($files as $plugin => $file) {
          $hooks["{$name}_fusion_apply_group_{$plugin}_info"] = array(
            // The source path for a plugin is the plugin directory.
            'path' => $dir . '/' . basename(dirname($file->uri)),
          ) + $extension;
        }
      }
      foreach ($hooks as $function => $source) {
        if (function_exists($function)) {
          $extension_info = $function();
          if (isset($extension_info) && is_array($extension_info)) {

            // Prepare the skin group information.
            foreach ($extension_info as &$group) {
              $group += array(
                'title' => '',
                'description' => '',
                'weight' => 0,
              );
            }
            $group_info += $extension_info;
          }
        }
      }
    }

    // Allow modules to alter groups through hook_fusion_apply_group_info_alter().
    drupal_alter('fusion_apply_group_info', $group_info);
    cache_set('fusion_apply_group_info', $group_info);
  }
  return $group_info;
}