Commit 6a686533 authored by webchick's avatar webchick

#516124 by yched: Clean up some Field API TODOs and remove unused APIs.

parent f6ccf978
......@@ -368,9 +368,6 @@ function hook_field_validate($obj_type, $object, $field, $instance, $items, &$er
/**
* Define custom presave behavior for this module's field types.
*
* TODO: The behavior of this hook is going to change (see
* field_attach_presave()).
*
* @param $obj_type
* The type of $object.
* @param $object
......@@ -507,8 +504,7 @@ function hook_field_prepare_translation($obj_type, $object, $field, $instance, $
* Field API will call this function as many times as needed.
*
* @param $form
* The entire form array, $form['#node'] holds node information.
* TODO: Not #node any more.
* The entire form array.
* @param $form_state
* The form_state, $form_state['values'][$field['field_name']]
* holds the field's form values.
......
......@@ -6,12 +6,6 @@
* Field attach API, allowing objects (nodes, users, ...) to be 'fieldable'.
*/
// TODO D7 : consistency - do field_attach_functions return a value or alter in place ?
// TODO D7 : consistency - some of these functions process individual fields
// and others process the combined value of all fields.
// Should all iteration through available fields be done here instead of in Field?
/**
* Exception thrown by field_attach_validate() on field validation errors.
*/
......@@ -364,7 +358,6 @@ function _field_invoke_multiple_default($op, $obj_type, $objects, &$a = NULL, &$
* field_attach_view().
*/
function field_attach_form($obj_type, $object, &$form, &$form_state) {
// TODO : something's not right here : do we alter the form or return a value ?
$form += (array) _field_invoke_default('form', $obj_type, $object, $form, $form_state);
// Let other modules make changes to the form.
......@@ -512,7 +505,6 @@ function field_attach_load_revision($obj_type, $objects) {
*/
function field_attach_validate($obj_type, $object) {
$errors = array();
_field_invoke_default('validate', $obj_type, $object, $errors);
_field_invoke('validate', $obj_type, $object, $errors);
// Let other modules validate the object.
......@@ -611,8 +603,6 @@ function field_attach_submit($obj_type, $object, $form, &$form_state) {
* The object with fields to process.
*/
function field_attach_presave($obj_type, $object) {
// TODO : to my knowledge, no field module has any use for 'presave' on D6.
// should we keep this ?
_field_invoke('presave', $obj_type, $object);
// Let other modules act on presaving the object.
......
......@@ -102,9 +102,6 @@
* to other fields when used with this bundle. The weight affects
* ordering in both forms (see field_attach_form()) and rendered output
* (see field_attach_view()).
* TODO - this should probably become a context setting so that
* the weight can be different in the form and in various other
* contexts.
* - required (integer)
* TRUE if a value for this field is required when used with this
* bundle, FALSE otherwise. Currently, required-ness is only enforced
......@@ -276,7 +273,7 @@ function field_create_field($field) {
// Invoke external hooks after the cache is cleared for API consistency.
module_invoke_all('field_create_field', $field);
return $field;
}
......
......@@ -21,15 +21,9 @@ function field_default_extract_form_values($obj_type, $object, $field, $instance
}
}
function field_default_validate($obj_type, $object, $field, $instance, $items) {
// TODO: here we could validate that required fields are filled in (for programmatic save)
}
function field_default_submit($obj_type, $object, $field, $instance, &$items, $form, &$form_state) {
$field_name = $field['field_name'];
// TODO: should me move what's below to __extract_form_values ?
// Reorder items to account for drag-n-drop reordering.
if (field_behaviors_widget('multiple values', $instance) == FIELD_BEHAVIOR_DEFAULT) {
$items = _field_sort_items($field, $items);
......
......@@ -6,8 +6,6 @@
* Field forms management.
*/
// TODO : merge with field.default.inc ?
/**
* Create a separate form element for each field.
*/
......
......@@ -323,18 +323,12 @@ function _field_sort_items_value_helper($a, $b) {
/**
* Registry of available build modes.
* TODO : move into hook_fieldable_info() ?
*/
function field_build_modes($obj_type) {
static $info;
if (!isset($info[$obj_type])) {
// module_invoke_all messes numeric keys.
// TODO : revisit when we move away from numeric build modes.
$info[$obj_type] = array();
foreach (module_implements('field_build_modes') as $module) {
$info[$obj_type] += module_invoke($module, 'field_build_modes', $obj_type);
}
$info[$obj_type] = module_invoke_all('field_build_modes', $obj_type);
}
return $info[$obj_type];
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment