function _skinr_context_add_default_group in Skinr 7.2
Same name and namespace in other branches
- 8.2 skinr_context/skinr_context.module \_skinr_context_add_default_group()
Helper function to add a new default group to a skin configuration.
2 calls to _skinr_context_add_default_group()
- skinr_context_enable in skinr_context/
skinr_context.install - Implements hook_enable().
- skinr_context_skinr_skin_defaults_alter in skinr_context/
skinr_context.module - Implements hook_skinr_skin_defaults_alter().
File
- skinr_context/
skinr_context.module, line 661 - Provides Skinr integration with Context.
Code
function _skinr_context_add_default_group(&$skin) {
// Lookup existing group. Grab the one with the lowest weight for this set.
$params = array(
'module' => $skin->module,
'element' => $skin->element,
);
$gids = skinr_context_group_get_gids($params);
$gid = reset($gids);
if (!$gid) {
// Create a group.
$title = t('Default');
$group = (object) array(
'gid' => $skin->module . ':' . $skin->element . ':' . strtolower($title),
'module' => $skin->module,
'element' => $skin->element,
'title' => $title,
'description' => '',
'conditions' => array(
'sitewide' => array(
'values' => array(
1 => 1,
),
),
),
'condition_mode' => CONTEXT_CONDITION_MODE_OR,
'weight' => 0,
'status' => 1,
);
skinr_context_group_save($group);
$gid = $group->gid;
}
$skin->gid = $gid;
// Simulate insert to ensure group is linked.
//skinr_context_skinr_skin_insert($skin);
}