diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-02-03 17:30:13 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-02-03 17:30:13 +0000 |
commit | 607e9626d5af265b18e8319b156bb0fda3445cd4 (patch) | |
tree | ece98d14e826d14a711c9b572e3f43a428b9a365 /modules/field/field.autoload.inc | |
parent | d4867346f578906751f8ea0bd799c3fc1bfcbf48 (diff) | |
download | brdo-607e9626d5af265b18e8319b156bb0fda3445cd4.tar.gz brdo-607e9626d5af265b18e8319b156bb0fda3445cd4.tar.bz2 |
- Patch #361683by Barry, Yves, Karen, Moshe Weitzman, David Strauss, floriant, chx, David Rothstein: initial field API patch. More work to be done, but ... oh my!
Diffstat (limited to 'modules/field/field.autoload.inc')
-rw-r--r-- | modules/field/field.autoload.inc | 617 |
1 files changed, 617 insertions, 0 deletions
diff --git a/modules/field/field.autoload.inc b/modules/field/field.autoload.inc new file mode 100644 index 000000000..7a9d45ab2 --- /dev/null +++ b/modules/field/field.autoload.inc @@ -0,0 +1,617 @@ +<?php +/** + * DO NOT EDIT THIS FILE. It contains autoloading functions generated + * automatically by generate-autoload.pl. The function names, + * arguments, and PHPdoc are copied from the file that defines the + * underlying function. To edit them, edit the underlying file instead. + */ + +/** + * @ingroup field_attach + * @{ + */ + +/** + * Add form elements for all fields for an object to a form structure. + * + * @param $obj_type + * The type of $object; e.g. 'node' or 'user'. + * @param $object + * The object for which to load form elements, used to initialize + * default form values. + * @param $form + * The form structure to fill in. + * @param $form_state + * An associative array containing the current state of the form. + * + * TODO : document the resulting $form structure, like we do for + * field_attach_view(). + * + * This function is an autoloader for _field_attach_form() in modules/field/field.attach.inc. + */ +function field_attach_form($obj_type, $object, &$form, $form_state) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_form($obj_type, $object, $form, $form_state); +} + +/** + * Load all fields for the most current version of each of a set of + * objects of a single object type. + * + * @param $obj_type + * The type of objects for which to load fields; e.g. 'node' or + * 'user'. + * @param $objects + * An array of objects for which to load fields. The keys for + * primary id and bundle name to load are identified by + * hook_fieldable_info for $obj_type. + * @param $age + * FIELD_LOAD_CURRENT to load the most recent revision for all + * fields, or FIELD_LOAD_REVISION to load the version indicated by + * each object. Defaults to FIELD_LOAD_CURRENT; use + * field_attach_load_revision() instead of passing FIELD_LOAD_REVISION. + * @returns + * On return, the objects in $objects are modified by having the + * appropriate set of fields added. + * + * This function is an autoloader for _field_attach_load() in modules/field/field.attach.inc. + */ +function field_attach_load($obj_type, $objects, $age = FIELD_LOAD_CURRENT) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_load($obj_type, $objects, $age); +} + +/** + * Load all fields for a previous version of each of a set of + * objects of a single object type. + * + * @param $obj_type + * The type of objects for which to load fields; e.g. 'node' or + * 'user'. + * @param $objects + * An array of objects for which to load fields. The keys for + * primary id, revision id, and bundle name to load are identified by + * hook_fieldable_info for $obj_type. + * @returns + * On return, the objects in $objects are modified by having the + * appropriate set of fields added. + * + * This function is an autoloader for _field_attach_load_revision() in modules/field/field.attach.inc. + */ +function field_attach_load_revision($obj_type, $objects) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_load_revision($obj_type, $objects); +} + +/** + * Perform field validation against the field data in an object. + * Field validation is distinct from widget validation; the latter + * occurs during the Form API validation phase. + * + * NOTE: This functionality does not yet exist in its final state. + * Eventually, field validation will occur during field_attach_insert + * or _update which will throw an exception on failure. For now, + * fieldable entities must call this during their Form API validation + * phase, and field validation will call form_set_error for any + * errors. See http://groups.drupal.org/node/18019. + * + * @param $obj_type + * The type of $object; e.g. 'node' or 'user'. + * @param $object + * The object with fields to validate. + * + * This function is an autoloader for _field_attach_validate() in modules/field/field.attach.inc. + */ +function field_attach_validate($obj_type, &$object, $form = NULL) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_validate($obj_type, $object, $form); +} + +/** + * Perform necessary operations on field data submitted by a form. + * + * Currently, this accounts for drag-and-drop reordering of + * field values, and filtering of empty values. + * + * @param $obj_type + * The type of $object; e.g. 'node' or 'user'. + * @param $object + * The object being submitted. The 'bundle key', 'id key' and (if applicable) + * 'revision key' should be present. The actual field values will be read + * from $form_state['values']. + * @param $form + * The form structure to fill in. + * @param $form_state + * An associative array containing the current state of the form. + * + * 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) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_submit($obj_type, $object, $form, $form_state); +} + +/** + * Perform necessary operations just before fields data get saved. + * + * We take no specific action here, we just give other + * modules the opportunity to act. + * + * @param $obj_type + * The type of $object; e.g. 'node' or 'user'. + * @param $object + * The object with fields to process. + * + * This function is an autoloader for _field_attach_presave() in modules/field/field.attach.inc. + */ +function field_attach_presave($obj_type, &$object) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_presave($obj_type, $object); +} + +/** + * Save field data for a new object. The passed in object must + * already contain its id and (if applicable) revision id attributes. + * + * @param $obj_type + * The type of $object; e.g. 'node' or 'user'. + * @param $object + * The object with fields to save. + * + * This function is an autoloader for _field_attach_insert() in modules/field/field.attach.inc. + */ +function field_attach_insert($obj_type, &$object) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_insert($obj_type, $object); +} + +/** + * Save field data for an existing object. + * + * @param $obj_type + * The type of $object; e.g. 'node' or 'user'. + * @param $object + * The object with fields to save. + * + * This function is an autoloader for _field_attach_update() in modules/field/field.attach.inc. + */ +function field_attach_update($obj_type, &$object) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_update($obj_type, $object); +} + +/** + * Delete field data for an existing object. This deletes all + * revisions of field data for the object. + * + * @param $obj_type + * The type of $object; e.g. 'node' or 'user'. + * @param $object + * The object whose field data to delete. + * + * This function is an autoloader for _field_attach_delete() in modules/field/field.attach.inc. + */ +function field_attach_delete($obj_type, &$object) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_delete($obj_type, $object); +} + +/** + * Delete field data for a single revision of an existing object. The + * passed object must have a revision id attribute. + * + * @param $obj_type + * The type of $object; e.g. 'node' or 'user'. + * @param $object + * The object with fields to save. + * + * This function is an autoloader for _field_attach_delete_revision() in modules/field/field.attach.inc. + */ +function field_attach_delete_revision($obj_type, &$object) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_delete_revision($obj_type, $object); +} + +/** + * Generate and return a structured content array tree suitable for + * drupal_render() for all of the fields on an object. The format of + * each field's rendered content depends on the display formatter and + * its settings. + * + * @param $obj_type + * The type of $object; e.g. 'node' or 'user'. + * @param $object + * The object with fields to render. + * @param $teaser + * Whether to display the teaser only, as on the main page. + * @return + * A structured content array tree for drupal_render(). + * + * This function is an autoloader for _field_attach_view() in modules/field/field.attach.inc. + */ +function field_attach_view($obj_type, &$object, $teaser = FALSE) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_view($obj_type, $object, $teaser); +} + +/** + * To be called in entity preprocessor. + * + * - Adds $FIELD_NAME_rendered variables + * containing the themed output for the whole field. + * - Adds the formatted values in the 'view' key of the items. + * + * This function is an autoloader for _field_attach_preprocess() in modules/field/field.attach.inc. + */ +function field_attach_preprocess($obj_type, &$object) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_preprocess($obj_type, $object); +} + +/** + * Implementation of hook_nodeapi_prepare_translation. + * + * TODO D7: We do not yet know if this really belongs in Field API. + * + * This function is an autoloader for _field_attach_prepare_translation() in modules/field/field.attach.inc. + */ +function field_attach_prepare_translation(&$node) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_prepare_translation($node); +} + +/** + * Notify field.module that a new bundle was created. + * + * The default SQL-based storage doesn't need to do anytrhing about it, but + * others might. + * + * @param $bundle + * The name of the newly created bundle. + * + * This function is an autoloader for _field_attach_create_bundle() in modules/field/field.attach.inc. + */ +function field_attach_create_bundle($bundle) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_create_bundle($bundle); +} + +/** + * Notify field.module that a bundle was renamed. + * + * @param $bundle_old + * The previous name of the bundle. + * @param $bundle_new + * The new name of the bundle. + * + * This function is an autoloader for _field_attach_rename_bundle() in modules/field/field.attach.inc. + */ +function field_attach_rename_bundle($bundle_old, $bundle_new) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_rename_bundle($bundle_old, $bundle_new); +} + +/** + * Notify field.module the a bundle was deleted. + * + * This deletes the data for the field instances as well as the field instances + * themselves. This function actually just marks the data and field instances + * and deleted, leaving the garbage collection for a separate process, because + * it is not always possible to delete this much data in a single page request + * (particularly since for some field types, the deletion is more than just a + * simple DELETE query). + * + * @param $bundle + * The bundle to delete. + * + * This function is an autoloader for _field_attach_delete_bundle() in modules/field/field.attach.inc. + */ +function field_attach_delete_bundle($bundle) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_delete_bundle($bundle); +} + +/** + * Helper function to extract id, vid, and bundle name from an object. + * + * @param $obj_type + * The type of $object; e.g. 'node' or 'user'. + * @param $object + * The object from which to extract values. + * @return + * A numerically indexed array (not a hash table) containing these + * elements: + * + * 0: primary id of the object + * 1: revision id of the object, or NULL if $obj_type is not versioned + * 2: bundle name of the object + * 3: whether $obj_type's fields should be cached (TRUE/FALSE) + * + * This function is an autoloader for _field_attach_extract_ids() in modules/field/field.attach.inc. + */ +function field_attach_extract_ids($object_type, $object) { + require_once DRUPAL_ROOT . '/modules/field/field.attach.inc'; + return _field_attach_extract_ids($object_type, $object); +} + +/** + * @} End of "field_attach" + */ + +/** + * @ingroup field_info + * @{ + */ + +/** + * Helper function for determining the behavior of a field + * with respect to a given operation. + * + * @param $op + * The name of the operation. + * Currently supported : none + * // TODO D7: no use cases (yet ?) - do we want to keep that function ?. + * @param $field + * The field array. + * @return + * FIELD_BEHAVIOR_NONE - do nothing for this operation. + * FIELD_BEHAVIOR_CUSTOM - use the field's callback function. + * FIELD_BEHAVIOR_DEFAULT - use field.module default behavior. + * + * This function is an autoloader for _field_behaviors_field() in modules/field/field.info.inc. + */ +function field_behaviors_field($op, $field) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_behaviors_field($op, $field); +} + +/** + * Helper function for determining the behavior of a widget + * with respect to a given operation. + * + * @param $op + * The name of the operation. + * Currently supported: 'default value', 'multiple values'. + * @param $instance + * The field instance array. + * @return + * FIELD_BEHAVIOR_NONE - do nothing for this operation. + * FIELD_BEHAVIOR_CUSTOM - use the widget's callback function. + * FIELD_BEHAVIOR_DEFAULT - use field.module default behavior. + * + * This function is an autoloader for _field_behaviors_widget() in modules/field/field.info.inc. + */ +function field_behaviors_widget($op, $instance) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_behaviors_widget($op, $instance); +} + +/** + * Helper function for determining the behavior of a formatter + * with respect to a given operation. + * + * @param $op + * The name of the operation. + * Currently supported: 'multiple values' + * @param $display + * The $instance['display'][$build_mode] array. + * @return + * FIELD_BEHAVIOR_NONE - do nothing for this operation. + * FIELD_BEHAVIOR_CUSTOM - use the formatter's callback function. + * FIELD_BEHAVIOR_DEFAULT - use field module default behavior. + * + * This function is an autoloader for _field_behaviors_formatter() in modules/field/field.info.inc. + */ +function field_behaviors_formatter($op, $display) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_behaviors_formatter($op, $display); +} + +/** + * Return hook_field_info() data. + * + * @param $field_type + * (optional) A field type name. If ommitted, all field types will be + * returned. + * @return + * Either a field type description, as provided by hook_field_info(), or an + * array of all existing field types, keyed by field type name. + * + * This function is an autoloader for _field_info_field_types() in modules/field/field.info.inc. + */ +function field_info_field_types($field_type = NULL) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_info_field_types($field_type); +} + +/** + * Return hook_field_widget_info() data. + * + * @param $widget_type + * (optional) A widget type name. If ommitted, all widget types will be + * returned. + * @return + * Either a widget type description, as provided by + * hook_field_widget_info(), or an array of all existing widget + * types, keyed by widget type name. + * + * This function is an autoloader for _field_info_widget_types() in modules/field/field.info.inc. + */ +function field_info_widget_types($widget_type = NULL) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_info_widget_types($widget_type); +} + +/** + * Return hook_field_formatter_info() data. + * + * @param $formatter_type + * (optional) A formatter type name. If ommitted, all formatter types will be + * returned. + * @return + * Either a formatter type description, as provided by hook_field_formatter_info(), + * or an array of all existing widget types, keyed by widget type name. + * + * This function is an autoloader for _field_info_formatter_types() in modules/field/field.info.inc. + */ +function field_info_formatter_types($formatter_type = NULL) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_info_formatter_types($formatter_type); +} + +/** + * Return hook_fieldable_info() data. + * + * @param $obj_type + * (optional) A fieldable type name. If ommitted, all fieldable types will be + * returned. + * @return + * Either a fieldable type description, as provided by hook_fieldable_info(), + * or an array of all existing fieldable types, keyed by fieldable type name. + * + * This function is an autoloader for _field_info_fieldable_types() in modules/field/field.info.inc. + */ +function field_info_fieldable_types($obj_type = NULL) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_info_fieldable_types($obj_type); +} + +/** + * Return an array of fieldable bundle names and labels, for an individual + * object type or for all object types. + * + * This function is an autoloader for _field_info_bundles() in modules/field/field.info.inc. + */ +function field_info_bundles($obj_type = NULL) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_info_bundles($obj_type); +} + +/** + * Identity the type of entity that created a bundle. + * // TODO : might not be needed depending on how we solve + * // the 'namespace bundle names' issue + * + * This function is an autoloader for _field_info_bundle_entity() in modules/field/field.info.inc. + */ +function field_info_bundle_entity($bundle) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_info_bundle_entity($bundle); +} + +/** + * Return array of all field data, keyed by field name. + * + * @return + * An array of Field objects. + * + * This function is an autoloader for _field_info_fields() in modules/field/field.info.inc. + */ +function field_info_fields() { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_info_fields(); +} + +/** + * Return data about an individual field. + * + * @param $field_name + * + * This function is an autoloader for _field_info_field() in modules/field/field.info.inc. + */ +function field_info_field($field_name) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_info_field($field_name); +} + +/** + * Return an array of instance data for a given bundle, + * or for all known bundles, keyed by bundle name and field name. + * + * @param $bundle_name + * If set, return information on just this bundle. + * + * This function is an autoloader for _field_info_instances() in modules/field/field.info.inc. + */ +function field_info_instances($bundle_name = NULL) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_info_instances($bundle_name); +} + +/** + * Return an array of instance data for a specific field and bundle. + * + * This function is an autoloader for _field_info_instance() in modules/field/field.info.inc. + */ +function field_info_instance($field_name, $bundle_name) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_info_instance($field_name, $bundle_name); +} + +/** + * Return a field type's default settings. + * + * @param $type + * A field type name. + * @return + * The field type's default settings, as provided by hook_field_info(), or an + * empty array. + * + * This function is an autoloader for _field_info_field_settings() in modules/field/field.info.inc. + */ +function field_info_field_settings($type) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_info_field_settings($type); +} + +/** + * Return a field type's default instance settings. + * + * @param $type + * A field type name. + * @return + * The field type's default instance settings, as provided by + * hook_field_info(), or an empty array. + * + * This function is an autoloader for _field_info_instance_settings() in modules/field/field.info.inc. + */ +function field_info_instance_settings($type) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_info_instance_settings($type); +} + +/** + * Return a field widget's default settings. + * + * @param $type + * A widget type name. + * @return + * The field type's default settings, as provided by hook_field_info(), or an + * empty array. + * + * This function is an autoloader for _field_info_widget_settings() in modules/field/field.info.inc. + */ +function field_info_widget_settings($type) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_info_widget_settings($type); +} + +/** + * Return a field formatter's default settings. + * + * @param $type + * A field formatter type name. + * @return + * The field formatter's default settings, as provided by + * hook_field_info(), or an empty array. + * + * This function is an autoloader for _field_info_formatter_settings() in modules/field/field.info.inc. + */ +function field_info_formatter_settings($type) { + require_once DRUPAL_ROOT . '/modules/field/field.info.inc'; + return _field_info_formatter_settings($type); +} + +/** + * @} End of "field_info" + */ |