You are here

function skinr_context_group_storage in Skinr 8.2

Same name and namespace in other branches
  1. 7.2 skinr_context/skinr_context.module \skinr_context_group_storage()

Returns a skin settings group's storage method.

Parameters

$skin: A skin settings group.

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.

1 call to skinr_context_group_storage()
SkinrContextApiTestCase::testSkinrContextGroupDefaults in skinr_context/tests/skinr_context.test
Test default skin settings groups (in code).

File

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

Code

function skinr_context_group_storage($group) {
  $default_groups = _skinr_context_group_get_defaults();
  $storage = SKINR_STORAGE_IN_DATABASE;
  if (isset($default_groups[$group->gid])) {
    $default_group = clone $default_groups[$group->gid];

    // Make sure group has same processing as import.
    _skinr_context_group_import($default_group);

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

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

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