Commit 6eb7dfed authored by tim.plunkett's avatar tim.plunkett Committed by tim.plunkett
Browse files

Issue #1548240 by fgm, tim.plunkett | GiorgosK: $this->original_value did not...

Issue #1548240 by fgm, tim.plunkett | GiorgosK: $this->original_value did not always existe in views_handler_field::render_text().
parent 2bbc2731
......@@ -46,6 +46,13 @@ class views_handler_field extends views_handler {
var $field_alias = 'unknown';
var $aliases = array();
/**
* The field value prior to any rewriting.
*
* @var mixed
*/
public $original_value = NULL;
/**
* @var array
* Stores additional fields which get's added to the query.
......@@ -1080,6 +1087,10 @@ function render($values) {
function advanced_render($values) {
if ($this->allow_advanced_render() && method_exists($this, 'render_item')) {
$raw_items = $this->get_items($values);
// If there are no items, set the original value to NULL.
if (empty($raw_items)) {
$this->original_value = NULL;
}
}
else {
$value = $this->render($values);
......
......@@ -273,6 +273,8 @@ class viewsHandlerFieldFieldTest extends ViewsFieldApiTestHelper {
// Setup a field with cardinality > 1.
$this->fields[3] = $field = field_create_field(array('field_name' => 'field_name_3', 'type' => 'text', 'cardinality' => FIELD_CARDINALITY_UNLIMITED));
// Setup a field that will have no value.
$this->fields[4] = $field = field_create_field(array('field_name' => 'field_name_4', 'type' => 'text', 'cardinality' => FIELD_CARDINALITY_UNLIMITED));
$this->setUpInstances();
......@@ -290,6 +292,8 @@ class viewsHandlerFieldFieldTest extends ViewsFieldApiTestHelper {
for ($j = 0; $j < 5; $j++) {
$edit[$this->fields[3]['field_name']][LANGUAGE_NOT_SPECIFIED][$j]['value'] = $this->randomName(8);
}
// Set this field to be empty.
$edit[$this->fields[4]['field_name']] = array();
$this->nodes[$i] = $this->drupalCreateNode($edit);
}
......@@ -353,6 +357,10 @@ class viewsHandlerFieldFieldTest extends ViewsFieldApiTestHelper {
}
$this->assertEqual($rendered_field, implode(', ', $items), 'Take sure that the amount of items are limited.');
}
// Test that an empty field is rendered without error.
$rendered_field = $view->style_plugin->get_field(4, $this->fields[4]['field_name']);
$view->destroy();
// Test delta limit + offset
......
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