You are here

function skinr_skin_storage in Skinr 7.2

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

Returns a skin configuration object's storage method.

Parameters

$skin: A skin configuration object.

Return value

SKINR_STORAGE_IN_DATABASE if stored in the database, SKINR_STORAGE_IN_CODE if stored in code, SKINR_STORAGE_IN_CODE_OVERRIDDEN if stored in code and overridden in db.

4 calls to skinr_skin_storage()
SkinrApiTestCase::testSkinrSkinDefaults in tests/skinr.test
Test default skin configurations (in code).
SkinrApiTestCase::testSkinrSkinLoadSave in tests/skinr.test
Test skinr_skin_save() against invalid entries.
SkinrContextUIAdminTestCase::testSkinListingWithGroups in skinr_context/tests/skinr_context_ui.test
Tests skin configuration listing functionality.
SkinrUIAdminTestCase::testSkinListing in tests/skinr_ui.test
Tests skin configuration listing functionality.

File

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

Code

function skinr_skin_storage($skin) {
  $default_skins = _skinr_skin_get_defaults();
  $storage = SKINR_STORAGE_IN_DATABASE;
  if (isset($default_skins[$skin->uuid])) {
    $default_skin = clone $default_skins[$skin->uuid];

    // Make sure skin has same processing as import.
    _skinr_skin_import($default_skin);

    // API version is only used for export.
    unset($default_skin->api_version);

    // Status shouldn't influence overridden.
    $default_skin->status = $skin->status;
    $storage = SKINR_STORAGE_IN_CODE;
    if ($default_skin != $skin) {

      // Default was overridden.
      $storage = SKINR_STORAGE_IN_CODE_OVERRIDDEN;
    }
  }
  return $storage;
}