function vertical_tabs_config_get_config in Vertical Tabs Config 7
Same name and namespace in other branches
- 8 vertical_tabs_config.module \vertical_tabs_config_get_config()
Returns module visibility configuration or -1.
2 calls to vertical_tabs_config_get_config()
- vertical_tabs_config_admin_settings in ./
vertical_tabs_config.admin.inc - Visibility configuration form.
- vertical_tabs_config_form_node_form_alter in ./
vertical_tabs_config.module - Implements hook_form_BASE_FORM_ID_alter().
File
- ./
vertical_tabs_config.module, line 188 - Vertical tabs config main file.
Code
function vertical_tabs_config_get_config() {
try {
$query = db_select('vertical_tabs_config', 'n');
$query
->fields('n', array(
'id',
'vertical_tab',
'content_type',
'roles',
'hidden',
));
$result = $query
->execute()
->fetchAll();
} catch (Exception $e) {
watchdog('vertical_tabs_config', $e
->getMessage());
return "-1";
}
if (isset($result) && is_array($result)) {
$conf_hash = array();
foreach ($result as $obj) {
$conf_hash[$obj->content_type][$obj->vertical_tab] = $obj->hidden;
if (!isset($conf_hash[$obj->content_type]['roles'])) {
$conf_hash[$obj->content_type]['roles'] = json_decode($obj->roles);
}
}
return $conf_hash;
}
else {
return "-1";
}
}