This commit was manufactured as part of Drupal's Great Git Migration to

create tag 'DRUPAL-6--2-9'.

Sprout from DRUPAL-6--2 2011-01-03 14:29:09 UTC Yves Chedemois <yched.drupal@free.fr> '#435520 by yched, sun: Fix text fields rendered as 'n/a' in some cases'
Cherrypick from DRUPAL-6--2 2011-01-07 13:37:55 UTC Yves Chedemois <yched.drupal@free.fr> 'Format changelog before rolling a release':
    CHANGELOG.txt
    includes/content.token.inc
    includes/views/handlers/content_handler_field.inc
    includes/views/handlers/content_handler_field_multiple.inc
parent ab1ab8c1
//$Id$
CCK 6.x-2.x
CCK 6.x-2.9
===========
Features
- #932680 by Dave Reid: Token integration - allow using of Token API's new $options param
- #1008184 by merlinofchaos, bojanz, dereine, yched: Adapt to Views 3 "semantic views" feature (backwards compatible with Views 2)
Bugfixes:
- #863226 by KarenS: make sure we have a function that will return inactive instances when other instances of the same field are still active.
- #887742 by yched: fix notices in _content_get_formatter() in some Views
- #736440 by yched, dhthwy: fix memory leaks on long running migration scripts (e.g. migrate.module)
- #705512 by cha0s, roderick: 'add more' button - fix PHP 5.3 compatibility
- #894880 by yched: fix notices in check_plain() when rendering empty 'plain text' values
- #728472 by Darren Oh: Ensure the module's preprocess functions run first
- #932680 by Dave Reid: Token integration : allow using of Token API's new $options param
- #986612 by Dave Reid: Token integration - fix variable name clash (harmless in normal cases)
- #435520 by yched, sun: Fix text fields rendered as 'n/a' in some cases
- #739490 by foripepe: Token integration - fix notices during token generation
CCK 6.x-2.8
===========
......
......@@ -30,7 +30,7 @@ function content_token_values($type, $object = NULL, $options = array()) {
// incoming $object causes memory leak issues on long-running scripts such
// as migrations. See http://drupal.org/node/736440.
$node = drupal_clone($object);
$type = content_types($node->type);
$content_type = content_types($node->type);
$node->build_mode = 'token';
$node->content = array();
content_view($node);
......@@ -39,13 +39,13 @@ function content_token_values($type, $object = NULL, $options = array()) {
content_alter($node);
$field_types = _content_field_types();
foreach ($type['fields'] as $field) {
$items = $node->{$field['field_name']};
foreach ($content_type['fields'] as $field_name => $field) {
$items = isset($node->{$field_name}) ? $node->{$field_name} : array();
$function = $field_types[$field['type']]['module'] . '_token_values';
if (!empty($items) && function_exists($function)) {
$token_values = $function('field', $items, $options);
$token_values = (array) $function('field', $items, $options);
foreach ($token_values as $token => $value) {
$tokens[$field['field_name'] .'-'. $token] = $value;
$tokens[$field_name .'-'. $token] = $value;
}
}
}
......
......@@ -137,10 +137,22 @@ class content_handler_field extends views_handler_field_node {
/**
* Return DIV or SPAN based upon the field's element type.
*/
function element_type() {
function element_type($none_supported = FALSE, $default_empty = FALSE) {
// The 'element_type' property denotes Views 3.x ('semantic views'
// functionnality). If the property is set, and not set to '' ("default"),
// let the generic method handle the output.
if (isset($this->options['element_type']) && $this->options['element_type'] !== '') {
return parent::element_type($none_supported, $default_empty);
}
if ($default_empty) {
return '';
}
if (isset($this->definition['element type'])) {
return $this->definition['element type'];
}
// TODO Figure out exactly when to return a div or a <span>. Any field
// that ever needs to be shown inline in Views UI. It needs to return
// a div for textareas to prevent wrapping a <span> around a <p>.
......
......@@ -191,14 +191,27 @@ class content_handler_field_multiple extends content_handler_field {
* Fields rendered with the 'group multiple' option use <div> markers,
* and thus shouldn't be wrapped in a <span>.
*/
function element_type() {
function element_type($none_supported = FALSE, $default_empty = FALSE) {
// If this is not a grouped field, use the parent method.
if (!$this->defer_query) {
return parent::element_type();
return parent::element_type($none_supported, $default_empty);
}
// The 'element_type' property denotes Views 3.x ('semantic views'
// functionnality). If the property is set, and not set to '' ("default"),
// let the generic method handle the output.
if (isset($this->options['element_type']) && $this->options['element_type'] !== '') {
return parent::element_type($none_supported, $default_empty);
}
if ($default_empty) {
return '';
}
if (isset($this->definition['element type'])) {
return $this->definition['element type'];
}
return 'div';
}
......
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