Commit abe722f0 authored by webchick's avatar webchick

#453726 by yched: Remove unnecessary &s next to object parameters in field API.

parent 314b9185
...@@ -494,7 +494,7 @@ function hook_field_attach_form($obj_type, $object, &$form, &$form_state) { ...@@ -494,7 +494,7 @@ function hook_field_attach_form($obj_type, $object, &$form, &$form_state) {
* set as an empty array. * set as an empty array.
* - Loaded field names are set as keys in $skip_fields. * - Loaded field names are set as keys in $skip_fields.
*/ */
function hook_field_attach_pre_load($obj_type, &$objects, $age, &$skip_fields) { function hook_field_attach_pre_load($obj_type, $objects, $age, &$skip_fields) {
} }
/** /**
...@@ -512,7 +512,7 @@ function hook_field_attach_pre_load($obj_type, &$objects, $age, &$skip_fields) { ...@@ -512,7 +512,7 @@ function hook_field_attach_pre_load($obj_type, &$objects, $age, &$skip_fields) {
* *
* See field_attach_load() for details and arguments. * See field_attach_load() for details and arguments.
*/ */
function hook_field_attach_load($obj_type, &$objects, $age) { function hook_field_attach_load($obj_type, $objects, $age) {
} }
/** /**
...@@ -688,7 +688,7 @@ function hook_field_attach_delete_bundle($bundle, $instances) { ...@@ -688,7 +688,7 @@ function hook_field_attach_delete_bundle($bundle, $instances) {
* Loaded field values are added to $objects. Fields with no values should be * Loaded field values are added to $objects. Fields with no values should be
* set as an empty array. * set as an empty array.
*/ */
function hook_field_storage_load($obj_type, &$objects, $age, $skip_fields) { function hook_field_storage_load($obj_type, $objects, $age, $skip_fields) {
} }
/** /**
......
...@@ -155,7 +155,7 @@ function __construct($errors) { ...@@ -155,7 +155,7 @@ function __construct($errors) {
* - TRUE: use the default field implementation of the field hook. * - TRUE: use the default field implementation of the field hook.
* - FALSE: use the field module's implementation of the field hook. * - FALSE: use the field module's implementation of the field hook.
*/ */
function _field_invoke($op, $obj_type, &$object, &$a = NULL, &$b = NULL, $default = FALSE) { function _field_invoke($op, $obj_type, $object, &$a = NULL, &$b = NULL, $default = FALSE) {
list(, , $bundle) = field_attach_extract_ids($obj_type, $object); list(, , $bundle) = field_attach_extract_ids($obj_type, $object);
$instances = field_info_instances($bundle); $instances = field_info_instances($bundle);
...@@ -206,7 +206,7 @@ function _field_invoke($op, $obj_type, &$object, &$a = NULL, &$b = NULL, $defaul ...@@ -206,7 +206,7 @@ function _field_invoke($op, $obj_type, &$object, &$a = NULL, &$b = NULL, $defaul
* @return * @return
* An array of returned values keyed by object id. * An array of returned values keyed by object id.
*/ */
function _field_invoke_multiple($op, $obj_type, &$objects, &$a = NULL, &$b = NULL, $default = FALSE) { function _field_invoke_multiple($op, $obj_type, $objects, &$a = NULL, &$b = NULL, $default = FALSE) {
$fields = array(); $fields = array();
$grouped_instances = array(); $grouped_instances = array();
$grouped_objects = array(); $grouped_objects = array();
...@@ -226,7 +226,7 @@ function _field_invoke_multiple($op, $obj_type, &$objects, &$a = NULL, &$b = NUL ...@@ -226,7 +226,7 @@ function _field_invoke_multiple($op, $obj_type, &$objects, &$a = NULL, &$b = NUL
$fields[$field_name] = field_info_field($field_name); $fields[$field_name] = field_info_field($field_name);
} }
$grouped_instances[$field_name][$id] = $instance; $grouped_instances[$field_name][$id] = $instance;
$grouped_objects[$field_name][$id] = &$objects[$id]; $grouped_objects[$field_name][$id] = $objects[$id];
$grouped_items[$field_name][$id] = isset($object->$field_name) ? $object->$field_name : array(); $grouped_items[$field_name][$id] = isset($object->$field_name) ? $object->$field_name : array();
} }
$return[$id] = array(); $return[$id] = array();
...@@ -267,14 +267,14 @@ function _field_invoke_multiple($op, $obj_type, &$objects, &$a = NULL, &$b = NUL ...@@ -267,14 +267,14 @@ function _field_invoke_multiple($op, $obj_type, &$objects, &$a = NULL, &$b = NUL
/** /**
* Invoke field.module's version of a field hook. * Invoke field.module's version of a field hook.
*/ */
function _field_invoke_default($op, $obj_type, &$object, &$a = NULL, &$b = NULL) { function _field_invoke_default($op, $obj_type, $object, &$a = NULL, &$b = NULL) {
return _field_invoke($op, $obj_type, $object, $a, $b, TRUE); return _field_invoke($op, $obj_type, $object, $a, $b, TRUE);
} }
/** /**
* Invoke field.module's version of a field hook on multiple objects. * Invoke field.module's version of a field hook on multiple objects.
*/ */
function _field_invoke_multiple_default($op, $obj_type, &$objects, &$a = NULL, &$b = NULL) { function _field_invoke_multiple_default($op, $obj_type, $objects, &$a = NULL, &$b = NULL) {
return _field_invoke_multiple($op, $obj_type, $objects, $a, $b, TRUE); return _field_invoke_multiple($op, $obj_type, $objects, $a, $b, TRUE);
} }
...@@ -440,7 +440,7 @@ function _field_attach_load_revision($obj_type, $objects) { ...@@ -440,7 +440,7 @@ function _field_attach_load_revision($obj_type, $objects) {
* @return * @return
* Throws a FieldValidationException if validation errors are found. * Throws a FieldValidationException if validation errors are found.
*/ */
function _field_attach_validate($obj_type, &$object) { function _field_attach_validate($obj_type, $object) {
$errors = array(); $errors = array();
_field_invoke_default('validate', $obj_type, $object, $errors); _field_invoke_default('validate', $obj_type, $object, $errors);
_field_invoke('validate', $obj_type, $object, $errors); _field_invoke('validate', $obj_type, $object, $errors);
...@@ -484,7 +484,7 @@ function _field_attach_validate($obj_type, &$object) { ...@@ -484,7 +484,7 @@ function _field_attach_validate($obj_type, &$object) {
* @param $form_state * @param $form_state
* An associative array containing the current state of the form. * An associative array containing the current state of the form.
*/ */
function _field_attach_form_validate($obj_type, &$object, $form, &$form_state) { function _field_attach_form_validate($obj_type, $object, $form, &$form_state) {
// Extract field values from submitted values. // Extract field values from submitted values.
_field_invoke_default('extract_form_values', $obj_type, $object, $form, $form_state); _field_invoke_default('extract_form_values', $obj_type, $object, $form, $form_state);
...@@ -516,7 +516,7 @@ function _field_attach_form_validate($obj_type, &$object, $form, &$form_state) { ...@@ -516,7 +516,7 @@ function _field_attach_form_validate($obj_type, &$object, $form, &$form_state) {
* @param $form_state * @param $form_state
* An associative array containing the current state of the form. * An associative array containing the current state of the form.
*/ */
function _field_attach_submit($obj_type, &$object, $form, &$form_state) { function _field_attach_submit($obj_type, $object, $form, &$form_state) {
// Extract field values from submitted values. // Extract field values from submitted values.
_field_invoke_default('extract_form_values', $obj_type, $object, $form, $form_state); _field_invoke_default('extract_form_values', $obj_type, $object, $form, $form_state);
...@@ -540,7 +540,7 @@ function _field_attach_submit($obj_type, &$object, $form, &$form_state) { ...@@ -540,7 +540,7 @@ function _field_attach_submit($obj_type, &$object, $form, &$form_state) {
* @param $object * @param $object
* The object with fields to process. * The object with fields to process.
*/ */
function _field_attach_presave($obj_type, &$object) { function _field_attach_presave($obj_type, $object) {
// TODO : to my knowledge, no field module has any use for 'presave' on D6. // TODO : to my knowledge, no field module has any use for 'presave' on D6.
// should we keep this ? // should we keep this ?
_field_invoke('presave', $obj_type, $object); _field_invoke('presave', $obj_type, $object);
...@@ -568,7 +568,7 @@ function _field_attach_presave($obj_type, &$object) { ...@@ -568,7 +568,7 @@ function _field_attach_presave($obj_type, &$object) {
* Default values (if any) will be added to the $object parameter for fields * Default values (if any) will be added to the $object parameter for fields
* it leaves unspecified. * it leaves unspecified.
*/ */
function _field_attach_insert($obj_type, &$object) { function _field_attach_insert($obj_type, $object) {
_field_invoke_default('insert', $obj_type, $object); _field_invoke_default('insert', $obj_type, $object);
_field_invoke('insert', $obj_type, $object); _field_invoke('insert', $obj_type, $object);
...@@ -597,7 +597,7 @@ function _field_attach_insert($obj_type, &$object) { ...@@ -597,7 +597,7 @@ function _field_attach_insert($obj_type, &$object) {
* @param $object * @param $object
* The object with fields to save. * The object with fields to save.
*/ */
function _field_attach_update($obj_type, &$object) { function _field_attach_update($obj_type, $object) {
_field_invoke('update', $obj_type, $object); _field_invoke('update', $obj_type, $object);
// Let other modules act on updating the object, accumulating saved // Let other modules act on updating the object, accumulating saved
...@@ -626,7 +626,7 @@ function _field_attach_update($obj_type, &$object) { ...@@ -626,7 +626,7 @@ function _field_attach_update($obj_type, &$object) {
* @param $object * @param $object
* The object whose field data to delete. * The object whose field data to delete.
*/ */
function _field_attach_delete($obj_type, &$object) { function _field_attach_delete($obj_type, $object) {
_field_invoke('delete', $obj_type, $object); _field_invoke('delete', $obj_type, $object);
module_invoke(variable_get('field_storage_module', 'field_sql_storage'), 'field_storage_delete', $obj_type, $object); module_invoke(variable_get('field_storage_module', 'field_sql_storage'), 'field_storage_delete', $obj_type, $object);
...@@ -651,7 +651,7 @@ function _field_attach_delete($obj_type, &$object) { ...@@ -651,7 +651,7 @@ function _field_attach_delete($obj_type, &$object) {
* @param $object * @param $object
* The object with fields to save. * The object with fields to save.
*/ */
function _field_attach_delete_revision($obj_type, &$object) { function _field_attach_delete_revision($obj_type, $object) {
_field_invoke('delete revision', $obj_type, $object); _field_invoke('delete revision', $obj_type, $object);
module_invoke(variable_get('field_storage_module', 'field_sql_storage'), 'field_storage_delete_revision', $obj_type, $object); module_invoke(variable_get('field_storage_module', 'field_sql_storage'), 'field_storage_delete_revision', $obj_type, $object);
...@@ -677,7 +677,7 @@ function _field_attach_delete_revision($obj_type, &$object) { ...@@ -677,7 +677,7 @@ function _field_attach_delete_revision($obj_type, &$object) {
* @return * @return
* A structured content array tree for drupal_render(). * A structured content array tree for drupal_render().
*/ */
function _field_attach_view($obj_type, &$object, $teaser = FALSE) { function _field_attach_view($obj_type, $object, $teaser = FALSE) {
// Let field modules sanitize their data for output. // Let field modules sanitize their data for output.
_field_invoke('sanitize', $obj_type, $object); _field_invoke('sanitize', $obj_type, $object);
...@@ -697,7 +697,7 @@ function _field_attach_view($obj_type, &$object, $teaser = FALSE) { ...@@ -697,7 +697,7 @@ function _field_attach_view($obj_type, &$object, $teaser = FALSE) {
* containing the themed output for the whole field. * containing the themed output for the whole field.
* - Adds the formatted values in the 'view' key of the items. * - Adds the formatted values in the 'view' key of the items.
*/ */
function _field_attach_preprocess($obj_type, &$object) { function _field_attach_preprocess($obj_type, $object) {
return _field_invoke_default('preprocess', $obj_type, $object); return _field_invoke_default('preprocess', $obj_type, $object);
} }
......
...@@ -103,7 +103,7 @@ function field_attach_load_revision($obj_type, $objects) { ...@@ -103,7 +103,7 @@ function field_attach_load_revision($obj_type, $objects) {
* *
* This function is an autoloader for _field_attach_validate() in modules/field/field.attach.inc. * This function is an autoloader for _field_attach_validate() in modules/field/field.attach.inc.
*/ */
function field_attach_validate($obj_type, &$object) { function field_attach_validate($obj_type, $object) {
require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; require_once DRUPAL_ROOT . '/modules/field/field.attach.inc';
return _field_attach_validate($obj_type, $object); return _field_attach_validate($obj_type, $object);
} }
...@@ -138,7 +138,7 @@ function field_attach_validate($obj_type, &$object) { ...@@ -138,7 +138,7 @@ function field_attach_validate($obj_type, &$object) {
* *
* This function is an autoloader for _field_attach_form_validate() in modules/field/field.attach.inc. * This function is an autoloader for _field_attach_form_validate() in modules/field/field.attach.inc.
*/ */
function field_attach_form_validate($obj_type, &$object, $form, &$form_state) { function field_attach_form_validate($obj_type, $object, $form, &$form_state) {
require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; require_once DRUPAL_ROOT . '/modules/field/field.attach.inc';
return _field_attach_form_validate($obj_type, $object, $form, $form_state); return _field_attach_form_validate($obj_type, $object, $form, $form_state);
} }
...@@ -162,7 +162,7 @@ function field_attach_form_validate($obj_type, &$object, $form, &$form_state) { ...@@ -162,7 +162,7 @@ function field_attach_form_validate($obj_type, &$object, $form, &$form_state) {
* *
* This function is an autoloader for _field_attach_submit() in modules/field/field.attach.inc. * This function is an autoloader for _field_attach_submit() in modules/field/field.attach.inc.
*/ */
function field_attach_submit($obj_type, &$object, $form, &$form_state) { function field_attach_submit($obj_type, $object, $form, &$form_state) {
require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; require_once DRUPAL_ROOT . '/modules/field/field.attach.inc';
return _field_attach_submit($obj_type, $object, $form, $form_state); return _field_attach_submit($obj_type, $object, $form, $form_state);
} }
...@@ -180,7 +180,7 @@ function field_attach_submit($obj_type, &$object, $form, &$form_state) { ...@@ -180,7 +180,7 @@ function field_attach_submit($obj_type, &$object, $form, &$form_state) {
* *
* This function is an autoloader for _field_attach_presave() in modules/field/field.attach.inc. * This function is an autoloader for _field_attach_presave() in modules/field/field.attach.inc.
*/ */
function field_attach_presave($obj_type, &$object) { function field_attach_presave($obj_type, $object) {
require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; require_once DRUPAL_ROOT . '/modules/field/field.attach.inc';
return _field_attach_presave($obj_type, $object); return _field_attach_presave($obj_type, $object);
} }
...@@ -203,7 +203,7 @@ function field_attach_presave($obj_type, &$object) { ...@@ -203,7 +203,7 @@ function field_attach_presave($obj_type, &$object) {
* *
* This function is an autoloader for _field_attach_insert() in modules/field/field.attach.inc. * This function is an autoloader for _field_attach_insert() in modules/field/field.attach.inc.
*/ */
function field_attach_insert($obj_type, &$object) { function field_attach_insert($obj_type, $object) {
require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; require_once DRUPAL_ROOT . '/modules/field/field.attach.inc';
return _field_attach_insert($obj_type, $object); return _field_attach_insert($obj_type, $object);
} }
...@@ -218,7 +218,7 @@ function field_attach_insert($obj_type, &$object) { ...@@ -218,7 +218,7 @@ function field_attach_insert($obj_type, &$object) {
* *
* This function is an autoloader for _field_attach_update() in modules/field/field.attach.inc. * This function is an autoloader for _field_attach_update() in modules/field/field.attach.inc.
*/ */
function field_attach_update($obj_type, &$object) { function field_attach_update($obj_type, $object) {
require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; require_once DRUPAL_ROOT . '/modules/field/field.attach.inc';
return _field_attach_update($obj_type, $object); return _field_attach_update($obj_type, $object);
} }
...@@ -234,7 +234,7 @@ function field_attach_update($obj_type, &$object) { ...@@ -234,7 +234,7 @@ function field_attach_update($obj_type, &$object) {
* *
* This function is an autoloader for _field_attach_delete() in modules/field/field.attach.inc. * This function is an autoloader for _field_attach_delete() in modules/field/field.attach.inc.
*/ */
function field_attach_delete($obj_type, &$object) { function field_attach_delete($obj_type, $object) {
require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; require_once DRUPAL_ROOT . '/modules/field/field.attach.inc';
return _field_attach_delete($obj_type, $object); return _field_attach_delete($obj_type, $object);
} }
...@@ -250,7 +250,7 @@ function field_attach_delete($obj_type, &$object) { ...@@ -250,7 +250,7 @@ function field_attach_delete($obj_type, &$object) {
* *
* This function is an autoloader for _field_attach_delete_revision() in modules/field/field.attach.inc. * This function is an autoloader for _field_attach_delete_revision() in modules/field/field.attach.inc.
*/ */
function field_attach_delete_revision($obj_type, &$object) { function field_attach_delete_revision($obj_type, $object) {
require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; require_once DRUPAL_ROOT . '/modules/field/field.attach.inc';
return _field_attach_delete_revision($obj_type, $object); return _field_attach_delete_revision($obj_type, $object);
} }
...@@ -272,7 +272,7 @@ function field_attach_delete_revision($obj_type, &$object) { ...@@ -272,7 +272,7 @@ function field_attach_delete_revision($obj_type, &$object) {
* *
* This function is an autoloader for _field_attach_view() in modules/field/field.attach.inc. * This function is an autoloader for _field_attach_view() in modules/field/field.attach.inc.
*/ */
function field_attach_view($obj_type, &$object, $teaser = FALSE) { function field_attach_view($obj_type, $object, $teaser = FALSE) {
require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; require_once DRUPAL_ROOT . '/modules/field/field.attach.inc';
return _field_attach_view($obj_type, $object, $teaser); return _field_attach_view($obj_type, $object, $teaser);
} }
...@@ -286,7 +286,7 @@ function field_attach_view($obj_type, &$object, $teaser = FALSE) { ...@@ -286,7 +286,7 @@ function field_attach_view($obj_type, &$object, $teaser = FALSE) {
* *
* This function is an autoloader for _field_attach_preprocess() in modules/field/field.attach.inc. * This function is an autoloader for _field_attach_preprocess() in modules/field/field.attach.inc.
*/ */
function field_attach_preprocess($obj_type, &$object) { function field_attach_preprocess($obj_type, $object) {
require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; require_once DRUPAL_ROOT . '/modules/field/field.attach.inc';
return _field_attach_preprocess($obj_type, $object); return _field_attach_preprocess($obj_type, $object);
} }
......
...@@ -25,7 +25,7 @@ function field_default_validate($obj_type, $object, $field, $instance, $items) { ...@@ -25,7 +25,7 @@ function field_default_validate($obj_type, $object, $field, $instance, $items) {
// TODO: here we could validate that required fields are filled in (for programmatic save) // 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) { function field_default_submit($obj_type, $object, $field, $instance, &$items, $form, &$form_state) {
$field_name = $field['field_name']; $field_name = $field['field_name'];
// TODO: should me move what's below to __extract_form_values ? // TODO: should me move what's below to __extract_form_values ?
...@@ -46,7 +46,7 @@ function field_default_submit($obj_type, &$object, $field, $instance, &$items, $ ...@@ -46,7 +46,7 @@ function field_default_submit($obj_type, &$object, $field, $instance, &$items, $
* This can happen with programmatic saves, or on form-based creation where * This can happen with programmatic saves, or on form-based creation where
* the current user doesn't have 'edit' permission for the field. * the current user doesn't have 'edit' permission for the field.
*/ */
function field_default_insert($obj_type, &$object, $field, $instance, &$items) { function field_default_insert($obj_type, $object, $field, $instance, &$items) {
// _field_invoke() populates $items with an empty array if the $object has no // _field_invoke() populates $items with an empty array if the $object has no
// entry for the field, so we check on the $object itself. // entry for the field, so we check on the $object itself.
if (!property_exists($object, $field['field_name']) && !empty($instance['default_value_function'])) { if (!property_exists($object, $field['field_name']) && !empty($instance['default_value_function'])) {
......
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