You are here

function _skinr_skin_get_defaults in Skinr 7.2

Same name and namespace in other branches
  1. 8.2 skinr.module \_skinr_skin_get_defaults()

Returns all default skin configuration objects.

5 calls to _skinr_skin_get_defaults()
SkinrApiTestCase::testSkinrSkinDefaults in tests/skinr.test
Test default skin configurations (in code).
SkinrApiTestCase::testSkinrSkinDefaultsDuplicates in tests/skinr.test
Test default skin configurations (in code) with duplicates.
skinr_skin_defaults_import in ./skinr.module
Imports default skin confiuration objects from code into database.
skinr_skin_revert in ./skinr.module
Revert a skin configuration object that's stored in code to its default state.
skinr_skin_storage in ./skinr.module
Returns a skin configuration object's storage method.
1 string reference to '_skinr_skin_get_defaults'
SkinrApiTestCase::testSkinrSkinDefaultsDuplicates in tests/skinr.test
Test default skin configurations (in code) with duplicates.

File

./skinr.module, line 889
Handles core Skinr functionality.

Code

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

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

    // Let modules modify the skin configuration.
    drupal_alter('skinr_skin_defaults', $default_skins);
    cache_set('skinr_skin_defaults', $default_skins);
  }
  return $default_skins;
}