function eck_property_widget_extract_value in Entity Construction Kit (ECK) 7.3
Helper function for extracting the value for a property from its widget form.
If one is available the 'value callback' function for the widget is called to processe the values returned.
Parameters
object $entity_type: The ECK entity_type object.
object $bundle: The ECK bundle object.
string $property_name: The machine name of the property for which the value should be returned.
array $widget: The widget info array as returned by eck_property_info_widget_types(TYPE).
array $form: The submitted form array.
array $form_state: The array containing the current state information for the form.
Return value
mixed The value that should be saved for this property.
1 call to eck_property_widget_extract_value()
- eck__manage_extra_field_form_submit in ./
eck.bundle.inc - Submit callback.
File
- ./
eck.bundle.inc, line 683
Code
function eck_property_widget_extract_value($entity_type, $bundle, $property_name, $widget, $form, &$form_state) {
$value = NULL;
// If the widget has a callback to extract the value then use it.
if (!empty($widget['value callback']) && function_exists($widget['value callback'])) {
$value = $widget['value callback']($entity_type, $bundle, $property_name, $widget, $form, $form_state);
}
else {
// By default just take the value matching the property name.
if (isset($form_state['values'][$property_name])) {
$value = $form_state['values'][$property_name];
}
}
return $value;
}