You are here

function fusion_apply_get_skin_info in Fusion Accelerator 7.2

Same name and namespace in other branches
  1. 7 fusion_apply/fusion_apply.module \fusion_apply_get_skin_info()

Retrieves all skins registered by modules and themes.

Return value

An array of skins.

8 calls to fusion_apply_get_skin_info()
FusionApplyApiTestCase::testFusionApplySkinInfo in fusion_apply/tests/fusion_apply.test
Tests hook_fusion_apply_skin_info().
fusion_apply_flatten_skins_array in fusion_apply/fusion_apply.module
Returns an array of classes.
fusion_apply_preprocess in fusion_apply/fusion_apply.module
Implements hook_preprocess().
fusion_apply_ui_admin_skins in fusion_apply/fusion_apply_ui.admin.inc
Form builder: Builds the skin configuration administration overview.
fusion_apply_ui_admin_skin_infos in fusion_apply/fusion_apply_ui.admin.inc
Menu callback: skins administration.

... See full list

File

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

Code

function fusion_apply_get_skin_info() {
  $skin_info =& drupal_static(__FUNCTION__);
  if (!isset($skin_info)) {
    if ($cached = cache_get('fusion_apply_skin_info')) {
      $skin_info = $cached->data;
      return $skin_info;
    }
    $skin_info = array();
    foreach (fusion_apply_implements() as $name => $extension) {
      $hooks = array(
        "{$name}_fusion_apply_skin_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_skin_{$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 information.
            fusion_apply_skin_info_process($extension_info, $source);
            $skin_info += $extension_info;
          }
        }
      }
    }

    // Allow modules to alter registered skin information.
    drupal_alter('fusion_apply_skin_info', $skin_info);
    cache_set('fusion_apply_skin_info', $skin_info);
  }
  return $skin_info;
}