function config_pages_context_get in Config Pages 7
Same name and namespace in other branches
- 8.3 config_pages.module \config_pages_context_get()
- 8 config_pages.module \config_pages_context_get()
- 8.2 config_pages.module \config_pages_context_get()
Return current context based on groups.
5 calls to config_pages_context_get()
- config_pages_create in ./
config_pages.module - Create a config_pages object.
- config_pages_get in ./
config_pages.inc - Fetch config value.
- config_pages_load_entity in ./
config_pages.inc - Load configuration entity.
- config_pages_render in ./
config_pages.inc - Theme specified config.
- config_pages_render_field in ./
config_pages.inc - Theme specified config.
File
- ./
config_pages.inc, line 203 - Logic functions.
Code
function config_pages_context_get($type) {
$context = array();
// Check which context groups applicable to this config.
$groups = array_keys(config_pages_context_groups($type));
if (!empty($groups)) {
// Sort array to keep context persistent.
sort($groups);
// Get context values for each group.
foreach ($groups as $group) {
list($module, $key) = explode(':', $group);
$value = module_invoke($module, 'config_pages_context_value', $key);
$value = strtr($value, array(
':' => '',
';' => '',
'=' => '',
));
if (!empty($value)) {
$context[$group] = $value;
}
}
}
// Allow modules to alter context.
drupal_alter('config_pages_context_get', $context, $type);
// Plain groups
foreach ($context as $group => $value) {
$context[$group] = $group . '=' . $value;
}
// Return context string.
return implode(';', $context);
}