You are here

function _skinr_context_group_get_defaults in Skinr 7.2

Same name and namespace in other branches
  1. 8.2 skinr_context/skinr_context.module \_skinr_context_group_get_defaults()

Returns all default skin settings group objects.

5 calls to _skinr_context_group_get_defaults()
SkinrContextApiTestCase::testSkinrContextGroupDefaults in skinr_context/tests/skinr_context.test
Test default skin settings groups (in code).
SkinrContextApiTestCase::testSkinrContextGroupDefaultsDuplicates in skinr_context/tests/skinr_context.test
Test default skin configurations (in code) with duplicates.
skinr_context_group_defaults_import in skinr_context/skinr_context.module
Imports default skin settings group objects from code into database.
skinr_context_group_revert in skinr_context/skinr_context.module
Revert a skin settings group object that's stored in code to its default state.
skinr_context_group_storage in skinr_context/skinr_context.module
Returns a skin settings group's storage method.
1 string reference to '_skinr_context_group_get_defaults'
SkinrContextApiTestCase::testSkinrContextGroupDefaultsDuplicates in skinr_context/tests/skinr_context.test
Test default skin configurations (in code) with duplicates.

File

skinr_context/skinr_context.module, line 293
Provides Skinr integration with Context.

Code

function _skinr_context_group_get_defaults() {
  $default_groups =& drupal_static(__FUNCTION__);
  if (!isset($default_groups)) {
    if ($cached = cache_get('skinr_context_group_defaults')) {
      $default_skins = $cached->data;
      return $default_skins;
    }

    // Don't use module_invoke_all() to prevent oddly merged defaults.
    $default_groups = array();
    foreach (module_implements('skinr_context_group_defaults') as $module) {
      $function = $module . '_skinr_context_group_defaults';
      if (function_exists($function)) {
        $result = call_user_func_array($function, array());
        if (isset($result) && is_array($result)) {
          $default_groups = array_merge($default_groups, $result);
        }
        elseif (isset($result)) {
          $default_groups[] = $result;
        }
      }
    }

    // Let modules modify the skin settings group.
    drupal_alter('skinr_context_group_defaults', $default_groups);
    cache_set('skinr_context_group_defaults', $default_groups);
  }
  return $default_groups;
}