function mathfield_update_7000 in Math Field 7
Add field dependency setting for existing mathfields.
File
- ./
mathfield.install, line 32 - Install, update and uninstall functions for the mathfield module.
Code
function mathfield_update_7000() {
foreach (field_info_field_map() as $field_name => $field) {
if ($field['type'] == 'mathfield') {
$info = field_info_field($field_name);
$expression = $info['settings']['expression'];
$tokens = _mathfield_extract_tokens($expression);
$info['settings']['field_dependencies'] = array();
foreach ($tokens as $data) {
$info['settings']['field_dependencies'][] = $data['field_name'];
}
field_update_field($info);
}
}
}