Answers:
类似于...
// Get the field info
$info = field_info_field('field_some_field');
// Get a reference to the values
$values = &$info['settings']['allowed_values'];
// Manipulate the values in some way, e.g.
$values['new_value'] = 'New Value';
// Save the field
field_update_field($info);
您最好将其allowed_values_function
与回调一起使用:
'settings' => array(
'allowed_values' => array(),
'allowed_values_function' => '_my_feature_module_options_list',
),
请参阅为实体字段创建动态允许值选项。