function fieldgroup_update_6005 in Content Construction Kit (CCK) 6.2
Same name and namespace in other branches
- 6.3 modules/fieldgroup/fieldgroup.install \fieldgroup_update_6005()
Add the 'exclude from $content' display setting to all existing groups.
File
- modules/
fieldgroup/ fieldgroup.install, line 273 - Implementation of hook_install().
Code
function fieldgroup_update_6005() {
$ret = array();
$result = db_query("SELECT * FROM {content_group}");
while ($type = db_fetch_array($result)) {
$new_settings = array();
$settings = unserialize($type['settings']);
$new_settings = $settings;
$display_settings = !empty($settings['display']) ? $settings['display'] : array();
if (!empty($display_settings)) {
foreach ($display_settings as $key => $val) {
$new_settings['display'][$key] = $val;
if ($key !== 'label' && is_array($val)) {
$new_settings['display'][$key]['exclude'] = 0;
}
}
}
else {
$new_settings['display'] = array(
'label' => array(
'format' => 'above',
),
'full' => array(
'format' => 'default',
'exclude' => 0,
),
'teaser' => array(
'format' => 'default',
'exclude' => 0,
),
);
}
db_query("UPDATE {content_group} SET settings='%s' WHERE group_name='%s' AND type_name='%s'", serialize($new_settings), $type['group_name'], $type['type_name']);
}
return $ret;
}