| Versionen | |
|---|---|
| drupal7 | field_associate_fields($module) |
Allows a module to update the database for fields and columns it controls.
string $module The name of the module to update on.
modules/
<?php
function field_associate_fields($module) {
$module_fields = module_invoke($module, 'field_info');
if ($module_fields) {
foreach ($module_fields as $name => $field_info) {
watchdog('field', 'Updating field type %type with module %module.', array('%type' => $name, '%module' => $module));
db_update('field_config')
->fields(array('module' => $module, 'active' => 1))
->condition('type', $name)
->execute();
}
}
$module_widgets = module_invoke($module, 'widget_info');
if ($module_widgets) {
foreach ($module_widgets as $name => $widget_info) {
watchdog('field', 'Updating widget type %type with module %module.', array('%type' => $name, '%module' => $module));
db_update('field_config_instance')
->fields(array('widget_module' => $module, 'widget_active' => 1))
->condition('widget_type', $name)
->execute();
}
}
}
?>
Kommentare
Kommentar hinzufügen