You are here

function skinr_skin_storage in Skinr 8.2

Same name and namespace in other branches
  1. 7.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.

6 calls to skinr_skin_storage()
SkinrApiTest::_testSkinrSkinDefaults in src/Tests/SkinrApiTest.php
Test default skin configurations (in code).
SkinrApiTest::_testSkinrSkinLoadSave in src/Tests/SkinrApiTest.php
Test skinr_skin_save() against invalid entries.
SkinrApiTestCase::testSkinrSkinDefaults in src/Tests/skinr.test
Test default skin configurations (in code).
SkinrApiTestCase::testSkinrSkinLoadSave in src/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.

... See full list

File

./skinr.module, line 995
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;
}