summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-08-01 06:03:48 +0000
committerDries Buytaert <dries@buytaert.net>2009-08-01 06:03:48 +0000
commit19f8439f8033f2645a5f14a1387b0224ee6d9747 (patch)
treee206113bd2d8bb3777e29b5b6d85224d8c378495
parent59f89d62b5c6e3e84f7ecb9c9293b99aeed01f47 (diff)
downloadbrdo-19f8439f8033f2645a5f14a1387b0224ee6d9747.tar.gz
brdo-19f8439f8033f2645a5f14a1387b0224ee6d9747.tar.bz2
- Patch #528182 by yched: added missing field type documentation and removed some unnessary code.
-rw-r--r--modules/field/field.api.php485
-rw-r--r--modules/field/field.default.inc2
-rw-r--r--modules/field/field.info.inc20
-rw-r--r--modules/field/modules/list/list.module6
-rw-r--r--modules/field/modules/number/number.module13
-rw-r--r--modules/field/modules/options/options.module3
-rw-r--r--modules/field/modules/text/text.module28
-rw-r--r--profiles/default/default.profile30
8 files changed, 406 insertions, 181 deletions
diff --git a/modules/field/field.api.php b/modules/field/field.api.php
index c6d80db86..02e9878c0 100644
--- a/modules/field/field.api.php
+++ b/modules/field/field.api.php
@@ -7,14 +7,14 @@
*/
/**
- * Inform the Field API about one or more fieldable types.
+ * Expose fieldable object types.
*
- * Inform the Field API about one or more fieldable types (object types to
- * which fields can be attached).
+ * Inform the Field API about object types to which fields can be attached.
+ * @see hook_fieldable_info_alter().
*
* @return
- * An array whose keys are fieldable object type names and
- * whose values are arrays with the following key/value pairs:
+ * An array whose keys are fieldable object type names and whose values are
+ * arrays with the following key/value pairs:
* - label: The human-readable name of the type.
* - object keys: An array describing how the Field API can extract the
* informations it needs from the objects of the type.
@@ -109,37 +109,62 @@ function hook_fieldable_info_alter(&$info) {
* @{
* Define field types, widget types, and display formatter types.
*
- * The bulk of the Field Types API are related to field types. A
- * field type represents a particular data storage type (integer,
- * string, date, etc.) that can be attached to a fieldable object.
- * hook_field_info() defines the basic properties of a field type, and
- * a variety of other field hooks are called by the Field Attach API
- * to perform field-type-specific actions.
- *
- * The Field Types API also defines widget types via
- * hook_field_widget_info(). Widgets are Form API elements with
- * additional processing capabilities. A field module can define
- * widgets that work with its own field types or with any other
- * module's field types. Widget hooks are typically called by the
- * Field Attach API when creating the field form elements during
- * field_attach_form().
- *
- * TODO Display formatters.
+ * The bulk of the Field Types API are related to field types. A field type
+ * represents a particular data storage type (integer, string, date, etc.) that
+ * can be attached to a fieldable object. hook_field_info() defines the basic
+ * properties of a field type, and a variety of other field hooks are called by
+ * the Field Attach API to perform field-type-specific actions.
+ * @see hook_field_info().
+ * @see hook_field_info_alter().
+ * @see hook_field_schema().
+ * @see hook_field_load().
+ * @see hook_field_validate().
+ * @see hook_field_presave().
+ * @see hook_field_insert().
+ * @see hook_field_update().
+ * @see hook_field_delete().
+ * @see hook_field_delete_revision().
+ * @see hook_field_sanitize().
+ *
+ * The Field Types API also defines two kinds of pluggable handlers: widgets
+ * and formatters, which specify how the field appears in edit forms and in
+ * displayed objects. Widgets and formatters can be implemented by a field-type
+ * module for it's own field types, or by a third-party module to extend the
+ * behavior of existing field types.
+ * @see hook_field_widget_info().
+ * @see hook_field_formatter_info().
*/
/**
* Define Field API field types.
*
* @return
- * An array whose keys are field type names and whose values are:
- *
- * label: TODO
- * description: TODO
- * settings: TODO
- * instance_settings: TODO
- * default_widget: TODO
- * default_formatter: TODO
- * behaviors: TODO
+ * An array whose keys are field type names and whose values are arrays
+ * describing the field type, with the following key/value pairs:
+ * - label: The human-readable name of the field type.
+ * - description: A short description for the field type.
+ * - settings: An array whose keys are the names of the settings available
+ * for the field type, and whose values are the default values for those
+ * settings.
+ * - instance_settings: An array whose keys are the names of the settings
+ * available for instances of the field type, and whose values are the
+ * default values for those settings.
+ * Instance-level settings can have different values on each field
+ * instance, and thus allow greater flexibility than field-level settings.
+ * It is recommended to put settings at the instance level whenever
+ * possible. Notable exceptions: settings acting on the schema definition,
+ * or settings that Views needs to use across field instances (e.g. list of
+ * allowed values).
+ * - default_widget: The machine name of the default widget to be used by
+ * instances of this field type, when no widget is specified in the
+ * instance definition. This widget must be available whenever the field
+ * type is available (i.e. provided by the field type module, or by a module
+ * the field type module depends on).
+ * - default_formatter: The machine name of the default formatter to be used
+ * by instances of this field type, when no formatter is specified in the
+ * instance definition. This formatter must be available whenever the field
+ * type is available (i.e. provided by the field type module, or by a module
+ * the field type module depends on).
*/
function hook_field_info() {
return array(
@@ -151,13 +176,22 @@ function hook_field_info() {
'default_widget' => 'text_textfield',
'default_formatter' => 'text_default',
),
- 'textarea' => array(
- 'label' => t('Textarea'),
+ 'text_long' => array(
+ 'label' => t('Long text'),
'description' => t('This field stores long text in the database.'),
+ 'settings' => array('max_length' => ''),
'instance_settings' => array('text_processing' => 0),
'default_widget' => 'text_textarea',
'default_formatter' => 'text_default',
),
+ 'text_with_summary' => array(
+ 'label' => t('Long text and summary'),
+ 'description' => t('This field stores long text in the database along with optional summary text.'),
+ 'settings' => array('max_length' => ''),
+ 'instance_settings' => array('text_processing' => 1, 'display_summary' => 0),
+ 'default_widget' => 'text_textarea_with_summary',
+ 'default_formatter' => 'text_summary_or_trimmed',
+ ),
);
}
@@ -189,8 +223,8 @@ function hook_field_info_alter(&$info) {
* A field structure.
* @return
* An associative array with the following keys:
- * - 'columns': an array of Schema API column specifications, keyed by
- * column name. This specifies what comprises a value for a given field.
+ * - columns: An array of Schema API column specifications, keyed by column name.
+ * This specifies what comprises a value for a given field.
* For example, a value for a number field is simply 'value', while a
* value for a formatted text field is the combination of 'value' and
* 'format'.
@@ -198,7 +232,7 @@ function hook_field_info_alter(&$info) {
* field settings when possible.
* No assumptions should be made on how storage engines internally use the
* original column name to structure their storage.
- * - 'indexes': an array of Schema API indexes definitions. Only columns that
+ * - indexes: An array of Schema API indexes definitions. Only columns that
* appear in the 'columns' array are allowed.
* Those indexes will be used as default indexes. Callers of
* field_create_field() can specify additional indexes, or, at their own
@@ -240,69 +274,6 @@ function hook_field_schema($field) {
}
/**
- * Define Field API widget types.
- *
- * @return
- * An array whose keys are field type names and whose values are:
- *
- * label: TODO
- * description: TODO
- * field types: TODO
- * settings: TODO
- * behaviors: TODO
- */
-function hook_field_widget_info() {
-}
-
-/**
- * Perform alterations on Field API widget types.
- *
- * @param $info
- * Array of informations on widget types exposed by hook_field_widget_info()
- * implementations.
- */
-function hook_field_widget_info_alter(&$info) {
- // Add a setting to a widget type.
- $info['text_textfield']['settings'] += array(
- 'mymodule_additional_setting' => 'default value',
- );
-
- // Let a new field type re-use an existing widget.
- $info['options_select']['field types'][] = 'my_field_type';
-}
-
-/*
- * Define Field API formatter types.
- *
- * @return
- * An array whose keys are field type names and whose values are:
- *
- * label: TODO
- * description: TODO
- * field types: TODO
- * behaviors: TODO
- */
-function hook_field_formatter_info() {
-}
-
-/**
- * Perform alterations on Field API formatter types.
- *
- * @param $info
- * Array of informations on widget types exposed by
- * hook_field_field_formatter_info() implementations.
- */
-function hook_field_formatter_info_alter(&$info) {
- // Add a setting to a formatter type.
- $info['text_default']['settings'] += array(
- 'mymodule_additional_setting' => 'default value',
- );
-
- // Let a new field type re-use an existing formatter.
- $info['text_default']['field types'][] = 'my_field_type';
-}
-
-/**
* Define custom load behavior for this module's field types.
*
* Unlike other field hooks, this hook operates on multiple objects. The
@@ -331,6 +302,73 @@ function hook_field_formatter_info_alter(&$info) {
* parameter by reference.
*/
function hook_field_load($obj_type, $objects, $field, $instances, &$items, $age) {
+ global $language;
+
+ foreach ($objects as $id => $object) {
+ foreach ($items[$id] as $delta => $item) {
+ if (!empty($instances[$id]['settings']['text_processing'])) {
+ // Only process items with a cacheable format, the rest will be
+ // handled by hook_field_sanitize().
+ $format = $item['format'];
+ if (filter_format_allowcache($format)) {
+ $lang = isset($object->language) ? $object->language : $language->language;
+ $items[$id][$delta]['safe'] = isset($item['value']) ? check_markup($item['value'], $format, $lang, FALSE, FALSE) : '';
+ if ($field['type'] == 'text_with_summary') {
+ $items[$id][$delta]['safe_summary'] = isset($item['summary']) ? check_markup($item['summary'], $format, $lang, FALSE, FALSE) : '';
+ }
+ }
+ }
+ else {
+ $items[$id][$delta]['safe'] = check_plain($item['value']);
+ if ($field['type'] == 'text_with_summary') {
+ $items[$id][$delta]['safe_summary'] = check_plain($item['summary']);
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Define custom sanitize behavior for this module's field types.
+ *
+ * This hook is invoked just before the field values are handed to formatters
+ * for display. Formatters being essentially theme functions, it is important
+ * that any data sanitization happens outside the theme layer.
+ *
+ * @param $obj_type
+ * The type of $object.
+ * @param $object
+ * The object for the operation.
+ * @param $field
+ * The field structure for the operation.
+ * @param $instance
+ * The instance structure for $field on $object's bundle.
+ * @param $items
+ * $object->{$field['field_name']}, or an empty array if unset.
+ */
+function hook_field_sanitize($obj_type, $object, $field, $instance, $items) {
+ global $language;
+ foreach ($items as $delta => $item) {
+ // Only sanitize items which were not already processed inside
+ // hook_field_load(), i.e. items with uncacheable text formats, or coming
+ // from a form preview.
+ if (!isset($items[$delta]['safe'])) {
+ if (!empty($instance['settings']['text_processing'])) {
+ $format = $item['format'];
+ $lang = isset($object->language) ? $object->language : $language->language;
+ $items[$delta]['safe'] = isset($item['value']) ? check_markup($item['value'], $format, $lang, FALSE) : '';
+ if ($field['type'] == 'text_with_summary') {
+ $items[$delta]['safe_summary'] = isset($item['summary']) ? check_markup($item['summary'], $format, $lang, FALSE) : '';
+ }
+ }
+ else {
+ $items[$delta]['safe'] = check_plain($item['value']);
+ if ($field['type'] == 'text_with_summary') {
+ $items[$delta]['safe_summary'] = check_plain($item['summary']);
+ }
+ }
+ }
+ }
}
/**
@@ -462,7 +500,9 @@ function hook_field_delete_revision($obj_type, $object, $field, $instance, $item
}
/**
- * Define custom sanitize behavior for this module's field types.
+ * Define custom prepare_translation behavior for this module's field types.
+ *
+ * TODO: This hook may or may not survive in Field API.
*
* @param $obj_type
* The type of $object.
@@ -475,26 +515,93 @@ function hook_field_delete_revision($obj_type, $object, $field, $instance, $item
* @param $items
* $object->{$field['field_name']}, or an empty array if unset.
*/
-function hook_field_sanitize($obj_type, $object, $field, $instance, $items) {
+function hook_field_prepare_translation($obj_type, $object, $field, $instance, $items) {
}
/**
- * Define custom prepare_translation behavior for this module's field types.
+ * Expose Field API widget types.
*
- * TODO: This hook may or may not survive in Field API.
+ * Widgets are Form API elements with additional processing capabilities.
+ * Widget hooks are typically called by the Field Attach API during the
+ * creation of the field form structure with field_attach_form().
+ * @see hook_field_widget_info_alter().
+ * @see hook_field_widget().
+ * @see hook_field_widget_error().
*
- * @param $obj_type
- * The type of $object.
- * @param $object
- * The object for the operation.
- * @param $field
- * The field structure for the operation.
- * @param $instance
- * The instance structure for $field on $object's bundle.
- * @param $items
- * $object->{$field['field_name']}, or an empty array if unset.
+ * @return
+ * An array describing the widget types implemented by the module.
+ *
+ * The keys are widget type names. To avoid name clashes, widget type
+ * names should be prefixed with the name of the module that exposes them.
+ *
+ * The values are arrays describing the widget type, with the following
+ * key/value pairs:
+ * - label: The human-readable name of the widget type.
+ * - description: A short description for the widget type.
+ * - field types: An array of field types the widget supports.
+ * - settings: An array whose keys are the names of the settings available
+ * for the widget type, and whose values are the default values for those
+ * settings.
+ * - behaviors: (optional) An array describing behaviors of the formatter.
+ * - multiple values:
+ * FIELD_BEHAVIOR_DEFAULT (default) if the widget allows the input of one
+ * single field value (most common case). The widget will be repeated for
+ * each value input.
+ * FIELD_BEHAVIOR_CUSTOM if one single copy of the widget can receive
+ * several field values. Examples: checkboxes, multiple select,
+ * comma-separated textfield...
+ * - default value:
+ * FIELD_BEHAVIOR_DEFAULT (default) if the widget accepts default values.
+ * FIELD_BEHAVIOR_NONE if the widget does not support default values.
*/
-function hook_field_prepare_translation($obj_type, $object, $field, $instance, $items) {
+function hook_field_widget_info() {
+ return array(
+ 'text_textfield' => array(
+ 'label' => t('Text field'),
+ 'field types' => array('text'),
+ 'settings' => array('size' => 60),
+ 'behaviors' => array(
+ 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
+ 'default value' => FIELD_BEHAVIOR_DEFAULT,
+ ),
+ ),
+ 'text_textarea' => array(
+ 'label' => t('Text area (multiple rows)'),
+ 'field types' => array('text_long'),
+ 'settings' => array('rows' => 5),
+ 'behaviors' => array(
+ 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
+ 'default value' => FIELD_BEHAVIOR_DEFAULT,
+ ),
+ ),
+ 'text_textarea_with_summary' => array(
+ 'label' => t('Text area with a summary'),
+ 'field types' => array('text_with_summary'),
+ 'settings' => array('rows' => 20, 'summary_rows' => 5),
+ 'behaviors' => array(
+ 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
+ 'default value' => FIELD_BEHAVIOR_DEFAULT,
+ ),
+ ),
+ );
+}
+
+
+/**
+ * Perform alterations on Field API widget types.
+ *
+ * @param $info
+ * Array of informations on widget types exposed by hook_field_widget_info()
+ * implementations.
+ */
+function hook_field_widget_info_alter(&$info) {
+ // Add a setting to a widget type.
+ $info['text_textfield']['settings'] += array(
+ 'mymodule_additional_setting' => 'default value',
+ );
+
+ // Let a new field type re-use an existing widget.
+ $info['options_select']['field types'][] = 'my_field_type';
}
/**
@@ -552,6 +659,158 @@ function hook_field_widget_error($element, $error) {
}
/**
+ * Expose Field API formatter types.
+ *
+ * Formatters are mainly theme functions that handle the output of individual
+ * field values. These theme calls are typically triggered during the execution
+ * of drupal_render() on the render structure built by field_attach_view().
+ *
+ * The name of the theme hook invoked when displaying the values is derived
+ * from formatter type names, following the pattern:
+ * field_formatter_FORMATTER_NAME
+ * The module implementing the formatters needs to register those theme hooks
+ * using hook_theme().
+ *
+ * @see hook_field_formatter_info().
+ * @see hook_field_formatter_info_alter().
+ * @see theme_field_formatter_FORMATTER_NAME().
+ *
+ * @return
+ * An array describing the formatter types implemented by the module.
+ *
+ * The keys are formatter type names. To avoid name clashes, formatter type
+ * names should be prefixed with the name of the module that exposes them.
+ *
+ * The values are arrays describing the formatter type, with the following
+ * key/value pairs:
+ * - label: The human-readable name of the formatter type.
+ * - description: A short description for the formatter type.
+ * - field types: An array of field types the formatter supports.
+ * - settings: An array whose keys are the names of the settings available
+ * for the formatter type, and whose values are the default values for
+ * those settings.
+ * - behaviors: (optional) An array describing behaviors of the formatter.
+ * - multiple values:
+ * FIELD_BEHAVIOR_DEFAULT (default) if the formatter displays one single
+ * field value (most common case). The formatter theme will be invoked
+ * iteratively on each of the field valies.
+ * FIELD_BEHAVIOR_CUSTOM if one single invocation of the formatter theme
+ * takes care of displays all the field values. Examples: points on
+ * a generated graph picture, a Google map, a single link to a popup...
+ */
+function hook_field_formatter_info() {
+ return array(
+ 'text_default' => array(
+ 'label' => t('Default'),
+ 'field types' => array('text', 'text_long', 'text_with_summary'),
+ 'behaviors' => array(
+ 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
+ ),
+ ),
+ 'text_plain' => array(
+ 'label' => t('Plain text'),
+ 'field types' => array('text', 'text_long', 'text_with_summary'),
+ 'behaviors' => array(
+ 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
+ ),
+ ),
+
+ // The text_trimmed formatter displays the trimmed version of the
+ // full element of the field. It is intended to be used with text
+ // and text_long fields. It also works with text_with_summary
+ // fields though the text_summary_or_trimmed formatter makes more
+ // sense for that field type.
+ 'text_trimmed' => array(
+ 'label' => t('Trimmed'),
+ 'field types' => array('text', 'text_long', 'text_with_summary'),
+ 'behaviors' => array(
+ 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
+ ),
+ ),
+
+ // The 'summary or trimmed' field formatter for text_with_summary
+ // fields displays returns the summary element of the field or, if
+ // the summary is empty, the trimmed version of the full element
+ // of the field.
+ 'text_summary_or_trimmed' => array(
+ 'label' => t('Summary or trimmed'),
+ 'field types' => array('text_with_summary'),
+ 'behaviors' => array(
+ 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
+ ),
+ ),
+ );
+}
+
+
+/**
+ * Perform alterations on Field API formatter types.
+ *
+ * @param $info
+ * Array of informations on formatter types exposed by
+ * hook_field_field_formatter_info() implementations.
+ */
+function hook_field_formatter_info_alter(&$info) {
+ // Add a setting to a formatter type.
+ $info['text_default']['settings'] += array(
+ 'mymodule_additional_setting' => 'default value',
+ );
+
+ // Let a new field type re-use an existing formatter.
+ $info['text_default']['field types'][] = 'my_field_type';
+}
+
+/**
+ * Theme function for a field formatter.
+ *
+ * This is an example of a 'single' formatter, displaying one single field
+ * value (the hook_field_formatter_info() entry uses
+ * 'multiple values' = FIELD_BEHAVIOR_DEFAULT).
+ *
+ * @param $element
+ * A render structure sub-array, containing the following keys:
+ * - #item: The field value being displayed.
+ * - #delta: The index of the value being displayed within the object(s values
+ * for the field.
+ * - #field_name: The name of the field being displayed.
+ * - #bundle: The bundle of the object being displayed.
+ * - #object: The object being displayed.
+ * - #object_type: The type of the object being displayed.
+ * - #formatter: The name of the formatter being used.
+ * - #settings: The array of formatter settings.
+ */
+function theme_field_formatter_FORMATTER_SINGLE($element) {
+ // This relies on a 'safe' element being prepared in hook_field_sanitize().
+ return $element['#item']['safe'];
+}
+
+/**
+ * Theme function for a field formatter.
+ *
+ * This is an example of a 'single' formatter, displaying all the field values
+ * (the hook_field_formatter_info() entry uses
+ * 'multiple values' = FIELD_BEHAVIOR_CUSTOM).
+ *
+ * @param $element
+ * A render structure sub-array, containing the following keys:
+ * - #field_name: The name of the field being displayed.
+ * - #bundle: The bundle of the object being displayed.
+ * - #object: The object being displayed.
+ * - #object_type: The type of the object being displayed.
+ * - #formatter: The name of the formatter being used.
+ * - #settings: The array of formatter settings.
+ * - numeric indexes: the field values being displayed.
+ */
+function theme_field_formatter_FORMATTER_MULTIPLE($element) {
+ $items = array();
+ foreach (element_children($element) as $key) {
+ $items[$key] = $key .':'. $element[$key]['#item']['value'];
+ }
+ $output = implode('|', $items);
+ return $output;
+}
+
+/**
* @} End of "ingroup field_type"
*/
diff --git a/modules/field/field.default.inc b/modules/field/field.default.inc
index 461986358..2d4be00ff 100644
--- a/modules/field/field.default.inc
+++ b/modules/field/field.default.inc
@@ -103,6 +103,8 @@ function field_default_insert($obj_type, $object, $field, $instance, &$items) {
* '#bundle' => $bundle_name,
* '#formatter' => $formatter_name,
* '#settings' => $formatter_settings,
+ * '#object' => $object,
+ * '#object_type' => $obj_type,
* ),
* );
*/
diff --git a/modules/field/field.info.inc b/modules/field/field.info.inc
index abe72197a..433494e1b 100644
--- a/modules/field/field.info.inc
+++ b/modules/field/field.info.inc
@@ -216,26 +216,6 @@ function _field_info_collate_fields($reset = FALSE) {
}
/**
- * 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.
- */
-function field_behaviors_field($op, $field) {
- $info = field_info_field_types($field['type']);
- return isset($info['behaviors'][$op]) ? $info['behaviors'][$op] : FIELD_BEHAVIOR_DEFAULT;
-}
-
-/**
* Helper function for determining the behavior of a widget
* with respect to a given operation.
*
diff --git a/modules/field/modules/list/list.module b/modules/field/modules/list/list.module
index 6ad2fbcd3..409cec782 100644
--- a/modules/field/modules/list/list.module
+++ b/modules/field/modules/list/list.module
@@ -135,16 +135,10 @@ function list_field_formatter_info() {
'list_default' => array(
'label' => t('Default'),
'field types' => array('list', 'list_boolean', 'list_text', 'list_number'),
- 'behaviors' => array(
- 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
- ),
),
'list_key' => array(
'label' => t('Key'),
'field types' => array('list', 'list_boolean', 'list_text', 'list_number'),
- 'behaviors' => array(
- 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
- ),
),
);
}
diff --git a/modules/field/modules/number/number.module b/modules/field/modules/number/number.module
index 108ed65f7..eb98aed5b 100644
--- a/modules/field/modules/number/number.module
+++ b/modules/field/modules/number/number.module
@@ -137,9 +137,6 @@ function number_field_formatter_info() {
'scale' => 0,
'prefix_suffix' => TRUE,
),
- 'behaviors' => array(
- 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
- ),
),
'number_decimal' => array(
'label' => t('default'),
@@ -150,16 +147,10 @@ function number_field_formatter_info() {
'scale' => 2,
'prefix_suffix' => TRUE,
),
- 'behaviors' => array(
- 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
- ),
),
'number_unformatted' => array(
'label' => t('unformatted'),
'field types' => array('number_integer', 'number_decimal', 'number_float'),
- 'behaviors' => array(
- 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
- ),
),
);
}
@@ -214,10 +205,6 @@ function number_field_widget_info() {
'number' => array(
'label' => t('Text field'),
'field types' => array('number_integer', 'number_decimal', 'number_float'),
- 'behaviors' => array(
- 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
- 'default value' => FIELD_BEHAVIOR_DEFAULT,
- ),
),
);
}
diff --git a/modules/field/modules/options/options.module b/modules/field/modules/options/options.module
index 6489ebb56..a49f5cd68 100644
--- a/modules/field/modules/options/options.module
+++ b/modules/field/modules/options/options.module
@@ -47,7 +47,6 @@ function options_field_widget_info() {
'field types' => array('list', 'list_boolean', 'list_text', 'list_number'),
'behaviors' => array(
'multiple values' => FIELD_BEHAVIOR_CUSTOM,
- 'default value' => FIELD_BEHAVIOR_DEFAULT,
),
),
'options_buttons' => array(
@@ -55,7 +54,6 @@ function options_field_widget_info() {
'field types' => array('list', 'list_boolean', 'list_text', 'list_number'),
'behaviors' => array(
'multiple values' => FIELD_BEHAVIOR_CUSTOM,
- 'default value' => FIELD_BEHAVIOR_DEFAULT,
),
),
'options_onoff' => array(
@@ -63,7 +61,6 @@ function options_field_widget_info() {
'field types' => array('list_boolean'),
'behaviors' => array(
'multiple values' => FIELD_BEHAVIOR_CUSTOM,
- 'default value' => FIELD_BEHAVIOR_DEFAULT,
),
),
);
diff --git a/modules/field/modules/text/text.module b/modules/field/modules/text/text.module
index 49aa814aa..23575ff6d 100644
--- a/modules/field/modules/text/text.module
+++ b/modules/field/modules/text/text.module
@@ -241,29 +241,20 @@ function text_field_formatter_info() {
'text_default' => array(
'label' => t('Default'),
'field types' => array('text', 'text_long', 'text_with_summary'),
- 'behaviors' => array(
- 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
- ),
),
'text_plain' => array(
'label' => t('Plain text'),
'field types' => array('text', 'text_long', 'text_with_summary'),
- 'behaviors' => array(
- 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
- ),
),
// The text_trimmed formatter displays the trimmed version of the
- // full element of the field. It is intended to be used with text
- // and text_long fields. It also works with text_with_summary
+ // full element of the field. It is intended to be used with text
+ // and text_long fields. It also works with text_with_summary
// fields though the text_summary_or_trimmed formatter makes more
// sense for that field type.
'text_trimmed' => array(
'label' => t('Trimmed'),
'field types' => array('text', 'text_long', 'text_with_summary'),
- 'behaviors' => array(
- 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
- ),
),
// The 'summary or trimmed' field formatter for text_with_summary
@@ -273,9 +264,6 @@ function text_field_formatter_info() {
'text_summary_or_trimmed' => array(
'label' => t('Summary or trimmed'),
'field types' => array('text_with_summary'),
- 'behaviors' => array(
- 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
- ),
),
);
}
@@ -464,28 +452,16 @@ function text_field_widget_info() {
'label' => t('Text field'),
'field types' => array('text'),
'settings' => array('size' => 60),
- 'behaviors' => array(
- 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
- 'default value' => FIELD_BEHAVIOR_DEFAULT,
- ),
),
'text_textarea' => array(
'label' => t('Text area (multiple rows)'),
'field types' => array('text_long'),
'settings' => array('rows' => 5),
- 'behaviors' => array(
- 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
- 'default value' => FIELD_BEHAVIOR_DEFAULT,
- ),
),
'text_textarea_with_summary' => array(
'label' => t('Text area with a summary'),
'field types' => array('text_with_summary'),
'settings' => array('rows' => 20, 'summary_rows' => 5),
- 'behaviors' => array(
- 'multiple values' => FIELD_BEHAVIOR_DEFAULT,
- 'default value' => FIELD_BEHAVIOR_DEFAULT,
- ),
),
);
}
diff --git a/profiles/default/default.profile b/profiles/default/default.profile
index 499121c00..73ed9962b 100644
--- a/profiles/default/default.profile
+++ b/profiles/default/default.profile
@@ -114,6 +114,36 @@ function default_profile_site_setup(&$install_state) {
'pages' => '',
'cache' => -1,
),
+ array(
+ 'module' => 'system',
+ 'delta' => 'main',
+ 'theme' => 'seven',
+ 'status' => 1,
+ 'weight' => 0,
+ 'region' => 'content',
+ 'pages' => '',
+ 'cache' => -1,
+ ),
+ array(
+ 'module' => 'system',
+ 'delta' => 'help',
+ 'theme' => 'seven',
+ 'status' => 1,
+ 'weight' => 0,
+ 'region' => 'help',
+ 'pages' => '',
+ 'cache' => -1,
+ ),
+ array(
+ 'module' => 'user',
+ 'delta' => 'login',
+ 'theme' => 'seven',
+ 'status' => 1,
+ 'weight' => 10,
+ 'region' => 'content',
+ 'pages' => '',
+ 'cache' => -1,
+ ),
);
$query = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache'));
foreach ($values as $record) {