function file_entity_update_7001 in File Entity (fieldable files) 7
Same name and namespace in other branches
- 7.3 file_entity.install \file_entity_update_7001()
- 7.2 file_entity.install \file_entity_update_7001()
Move file display configurations from the 'file_displays' variable to the {file_display} database table.
File
- ./
file_entity.install, line 177 - Install, update and uninstall functions for the file_entity module.
Code
function file_entity_update_7001() {
$file_displays = variable_get('file_displays');
if (!empty($file_displays)) {
foreach ($file_displays as $file_type => $file_type_displays) {
if (!empty($file_type_displays)) {
foreach ($file_type_displays as $view_mode => $view_mode_displays) {
if (!empty($view_mode_displays)) {
foreach ($view_mode_displays as $formatter_name => $display) {
if (!empty($display)) {
db_merge('file_display')
->key(array(
'name' => implode('__', array(
$file_type,
$view_mode,
$formatter_name,
)),
))
->fields(array(
'status' => isset($display['status']) ? $display['status'] : 0,
'weight' => isset($display['weight']) ? $display['weight'] : 0,
'settings' => isset($display['settings']) ? serialize($display['settings']) : NULL,
))
->execute();
}
}
}
}
}
}
}
variable_del('file_displays');
}