Dear all
As described in another issue #348190: Overriding template_preprocess_views_view_table leads to a clone error, it is possible to override the theme_preprocess_views_view_table from the views theme.inc in my own theme.
As soon as I add a date field a big problem will occur.
- I tested the preprocess function on a new drupal installation. It works ONLY if the view does NOT contain a date field
- As soon as I add a date (from the date module), a _clone error happens.
My investigations gave the following result:
- The error is thrown in the drupal_clone() function because the passed parameter is not an object, its an array.
- I found out, that the error comes from the date/date/date_handler_field_multiple.inc in the function render() {} because the variable "$values" is an array and not an object.
function render($values) {
// By this time $values is a pseudo node that will be passed
// to the theme. Add view information to it.
$values->date_info = !empty($this->view->date_info) ? $this->view->date_info : new StdClass();
$values->date_info->date_handler_fields = date_handler_fields($this->view);
return parent::render($values);
}
The point is, that as soon as the preprocess function is used, the date values are rendered as array and not as object. This is the reason why the error is thrown. Without the preprocess function, everything works perfect.
You can reproduce this phenomen with the following steps:
1. Use a new drupal installation
2. install views (2.3) and the date module (dev)
3. create a view containing only the node title field
4. add garland_preprocess_views_view_table() function to the garland template.php
5. copy the code from post #348190: Overriding template_preprocess_views_view_table leads to a clone error posting #6
6. Now test the view and you will see that it works (clear cache before)
7. Now add a date field to the view
8. clear the cache
9. the "clone" error from drupal_clone() will occure because the render function in the date module creates array and not objects.
I have NO idea what to do now. Anyone any ideas?
Comments
Comment #1
brainski commentedWas anyone able ro reproduce this issue?
Comment #2
arlinsandbulte commentedSeems fixed according to #348190: Overriding template_preprocess_views_view_table leads to a clone error