field_get_default_value
- Versions
- 7
field_get_default_value($obj_type, $object, $field, $instance, $langcode = NULL)
Helper function to get the default value for a field on an object.
Parameters
$obj_type The type of $object; e.g. 'node' or 'user'.
$object The object for the operation.
$field The field structure.
$instance The instance structure.
$langcode The field language to fill-in with the default value.
Related topics
Code
modules/field/field.module, line 290
<?php
function field_get_default_value($obj_type, $object, $field, $instance, $langcode = NULL) {
$items = array();
if (!empty($instance['default_value_function'])) {
$function = $instance['default_value_function'];
if (function_exists($function)) {
$items = $function($obj_type, $object, $field, $instance, $langcode);
}
}
elseif (!empty($instance['default_value'])) {
$items = $instance['default_value'];
}
return $items;
}
?>Login or register to post comments 