#369562 by bjaspan and yched: Clean up a few minor things in field API.

merge-requests/26/head
Angie Byron 2009-02-08 21:22:59 +00:00
parent d802c69a43
commit 341a95b803
6 changed files with 28 additions and 23 deletions

View File

@ -1,4 +1,6 @@
<?php <?php
// $Id$
/** /**
* DO NOT EDIT THIS FILE. It contains autoloading functions generated * DO NOT EDIT THIS FILE. It contains autoloading functions generated
* automatically by generate-autoload.pl. The function names, * automatically by generate-autoload.pl. The function names,

View File

@ -1,5 +1,14 @@
<?php <?php
// $Id$
/**
* @file
* TODO: Fill me in.
*/
/**
* TODO: Fill me in.
*/
class FieldException extends Exception {} class FieldException extends Exception {}
/** /**
@ -555,4 +564,4 @@ function field_delete_instance($field_name, $bundle) {
/** /**
* @} End of "defgroup field_crud". * @} End of "defgroup field_crud".
*/ */

View File

@ -1,16 +1,13 @@
<?php <?php
// $Id$
/** /**
* @file * @file
*
* Default 'implementations' of hook_field_*(). * Default 'implementations' of hook_field_*().
* *
* Handles common field housekeeping. * Handles common field housekeeping.
* Those implementations are special, as field.module does not define any field * Those implementations are special, as field.module does not define any field
* types. Those functions take care of default stuff common to all field types. * types. Those functions take care of default stuff common to all field types.
*
* Storage ops ('load', 'insert', 'update', 'delete', 'delete revisions')
* are not executed field by field, and are thus handled separately.
*/ */
function field_default_validate($obj_type, $object, $field, $instance, $items, $form) { function field_default_validate($obj_type, $object, $field, $instance, $items, $form) {
@ -67,7 +64,7 @@ function field_default_submit($obj_type, &$object, $field, $instance, &$items, $
* *
* The $object array will look like: * The $object array will look like:
* $object->content['field_foo']['wrapper'] = array( * $object->content['field_foo']['wrapper'] = array(
* '#type' => 'field', * '#theme' => 'field',
* '#title' => 'label' * '#title' => 'label'
* '#field_name' => 'field_name', * '#field_name' => 'field_name',
* '#object' => $object, * '#object' => $object,
@ -171,7 +168,7 @@ function field_default_view($obj_type, $object, $field, $instance, $items, $teas
$format_info = $info + array( $format_info = $info + array(
'#formatter' => $display['type'], '#formatter' => $display['type'],
'#settings' => $display['settings'], '#settings' => $display['settings'],
'#theme_wrapper' => $theme, '#theme' => $theme,
); );
if ($single) { if ($single) {
@ -187,7 +184,7 @@ function field_default_view($obj_type, $object, $field, $instance, $items, $teas
// The wrapper lets us get the themed output for the whole field // The wrapper lets us get the themed output for the whole field
// to populate the $FIELD_NAME_rendered variable for templates, // to populate the $FIELD_NAME_rendered variable for templates,
// and hide it from the $content variable if needed. // and hide it from the $content variable if needed.
// See 'preprocess' op and theme_content_field_wrapper()? // See 'preprocess' op and theme_content_field_wrapper().
$wrapper = $info + array( $wrapper = $info + array(
'field' => $element, 'field' => $element,
'#weight' => $instance['weight'], '#weight' => $instance['weight'],
@ -220,8 +217,8 @@ function field_wrapper_post_render($content, $element) {
* This is a theme function, so it can be overridden in different * This is a theme function, so it can be overridden in different
* themes to produce different results. * themes to produce different results.
* *
* The html for individual fields and groups are available in the * The html for individual fields are available in the $FIELD_NAME_rendered
* $FIELD_NAME_rendered and $GROUP_NAME_rendered variables. * variables.
* *
* @return * @return
* Whether or not the field's content is to be added in this context. * Whether or not the field's content is to be added in this context.
@ -250,4 +247,4 @@ function field_default_prepare_translation($obj_type, $object, $field, $instance
$addition[$field['field_name']] = $object->translation_source->$field['field_name']; $addition[$field['field_name']] = $object->translation_source->$field['field_name'];
} }
return $addition; return $addition;
} }

View File

@ -1,4 +1,10 @@
<?php <?php
// $Id$
/**
* @file
* TODO: Fill me in.
*/
/** /**
* @defgroup field_info Field Info API * @defgroup field_info Field Info API

View File

@ -14,8 +14,8 @@
* objects and takes care of storing, loading, editing, and rendering * objects and takes care of storing, loading, editing, and rendering
* field data. Any object type (node, user, etc.) can use the Field * field data. Any object type (node, user, etc.) can use the Field
* API to make itself "fieldable" and thus allow fields to be attached * API to make itself "fieldable" and thus allow fields to be attached
* to it. Other modules can provide a user interface for managing custom * to it. Other modules can provide a user interface for managing custom
* fields via a web browser as well as a wide and flexible variety of * fields via a web browser as well as a wide and flexible variety of
* data type, form element, and display format capabilities. * data type, form element, and display format capabilities.
* *
* - @link field_structs Data structures: Field, Instance, Bundle @endlink. * - @link field_structs Data structures: Field, Instance, Bundle @endlink.
@ -125,15 +125,6 @@ function field_menu() {
return $items; return $items;
} }
/**
* Implementation of hook elements().
*/
function field_elements() {
return array(
'field' => array(),
);
}
/** /**
* Implementation of hook_theme(). * Implementation of hook_theme().
*/ */

View File

@ -2,7 +2,7 @@
name = "Field API Test" name = "Field API Test"
description = "Support module for the Field API tests." description = "Support module for the Field API tests."
core = 7.x core = 7.x
package = testing package = Testing
files[] = field_test.module files[] = field_test.module
files[] = field_test.install files[] = field_test.install
version = VERSION version = VERSION