function _name_defaults in Name Field 7
Same name and namespace in other branches
- 6 name.module \_name_defaults()
Helper function to set the defaults for a name field / widget.
3 calls to _name_defaults()
- _name_field_get_options in includes/
name.content.inc - _name_field_instance_settings_form in includes/
name.content.inc - Implements hook_field_instance_settings_form().
- _name_field_widget_form in includes/
name.content.inc - Implements hook_field_widget_form().
File
- includes/
name.content.inc, line 611 - Provides additional Field functionality for the name module.
Code
function _name_defaults(&$settings, $key) {
if ($key == 'settings') {
$defaults = field_info_field_settings('name');
}
else {
$defaults = field_info_instance_settings('name');
}
$settings = isset($settings) ? (array) $settings : array();
foreach ($defaults as $index => $defaults) {
if (!isset($settings[$index])) {
if (is_array($defaults)) {
if (!array_key_exists($index, $settings)) {
$settings[$index] = array();
}
$settings[$index] += $defaults;
}
else {
$settings[$index] = $defaults;
}
}
}
}