Heine

  • home
  • drupal
  • drupal core commits
  • about
Home › Drupal Core Commits

Commit 232820 by dries

- Patch #508440 by yched: build mode, it is.

--- modules/field/field.crud.inc        2009/07/02 20:19:48     1.17
+++ modules/field/field.crud.inc        2009/07/02 20:37:03     1.18
@@ -137,24 +137,25 @@
  *         Each field widget type module defines and documents its own
  *         widget settings.
  * - display (array)
- *     A sub-array of key/value pairs identifying display contexts and the way
- *     the field should be displayed in that context.
- *     - example_context_1 (array)
+ *     A sub-array of key/value pairs identifying build modes and the way the
+ *     field values should be displayed in each build mode.
+ *     - full (array)
  *         A sub-array of key/value pairs of the display options to be used
- *         when the field is being displayed in the "example_context_1" context.
+ *         when the field is being displayed in the "full" build mode.
  *         - label (string)
  *             Position of the label. 'inline', 'above' and 'hidden' are the
  *             values recognized by the default 'field' theme implementation.
  *         - type (string)
- *             The type of the display formatter to use for the field in
- *             this context.
+ *             The type of the display formatter, or 'hidden' for no display.
  *         - settings (array)
  *             A sub-array of key/value pairs of display options specific to
- *             the display formatter used in this context.
+ *             the formatter.
  *         - module (string, read-only)
  *             The name of the module which implements the display formatter.
- *     - example_context_2
+ *     - teaser
  *         - ...
+ *     - other_build_mode
+ *        - ...
  *
  * TODO D7 : document max length for field types, widget types,
  * formatter names...
@@ -531,22 +532,22 @@
   $instance['widget']['module'] = $widget_module;
   $instance['widget']['active'] = $widget_active;
 
-  // Make sure there is at least display info for the 'full' context.
+  // Make sure there is at least display info for the 'full' build mode.
   $instance['display'] += array(
     'full' => array(),
   );
-  // Set default display settings for each context.
-  foreach ($instance['display'] as $context => $display) {
-    $instance['display'][$context] += array(
+  // Set default display settings for each build mode.
+  foreach ($instance['display'] as $build_mode => $display) {
+    $instance['display'][$build_mode] += array(
       'label' => 'above',
       // TODO: what if no 'default_formatter' specified ?
       'type' => $field_type['default_formatter'],
       'settings' => array(),
     );
-    $formatter_type = field_info_formatter_types($instance['display'][$context]['type']);
+    $formatter_type = field_info_formatter_types($instance['display'][$build_mode]['type']);
     // TODO : 'hidden' will raise PHP warnings.
-    $instance['display'][$context]['module'] = $formatter_type['module'];
-    $instance['display'][$context]['settings'] += field_info_formatter_settings($instance['display'][$context]['type']);
+    $instance['display'][$build_mode]['module'] = $formatter_type['module'];
+    $instance['display'][$build_mode]['settings'] += field_info_formatter_settings($instance['display'][$build_mode]['type']);
   }
 
   // The serialized 'data' column contains everything from $instance that does

--- modules/field/field.module  2009/06/24 18:16:38     1.15
+++ modules/field/field.module  2009/07/02 20:37:03     1.16
@@ -472,18 +472,19 @@
  *
  * To be used by third-party code (Views, Panels...) that needs to output
  * an isolated field. Do *not* use inside node templates, use the
- * $FIELD_NAME_rendered variables instead.
+ * render($content[FIELD_NAME]) instead.
  *
- * By default, the field is displayed using the settings defined for the
- * 'full' or 'teaser' contexts (depending on the value of the $build_mode param).
+ * The field will be displayed using the display options (label display,
+ * formatter settings...) specified in the $instance structure for the given
+ * build mode: $instance['display'][$build_mode].
  *
- * Different settings can be specified by adjusting $field['display'].
- *
- * @param $field
- *   The field definition.
  * @param $object
  *   The object containing the field to display. Must at least contain the id key,
  *   revision key (if applicable), bundle key, and the field data.
+ * @param $field
+ *   The field structure.
+ * @param $instance
+ *   The instance structure for $field on $object's bundle.
  * @param $build_mode
  *   Build mode, e.g. 'full', 'teaser'...
  * @return

No votes yet
  • Drupal Core
  • Download patch

Recent posts

  • The Joomlafication of the Dutch-speaking community
  • Upgraded from 6.14 to 6.15, but Drupal still thinks it's 6.14?
  • Google Friendconnect Drupal module not recommended (yet)
  • The OpenID 2.0 Compliance Crusade - Part I
  • Using <embed> for XSS
more

Security reviews

  • Afraid custom code makes your site vulnerable?
  • You don't really trust that module you just downloaded from Drupal.org?

Sleep better after a security review.

Tags

Captcha CSRF DOH! Drupal embed Input Format modx OpenID Performance Planet Drupal Security Varnish
more tags
  • home
  • drupal
  • drupal core commits
  • about

Copyright © 2010 by Heine Deelstra. All rights reserved.