Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When you add a new field "Last state change" to your view, you get a broken handler. It happens because when the module implements hook_views_data, it uses handlers names definned into a hook_views_handlers function, which is deprecated for Drupal 7.
hook_views_data defines the field "Last state change" like this:
// Last State change.
$data['support_ticket']['last_state_change'] = array(
'title' => t('Last state change'),
'help' => t('Date of last state change.'),
'field' => array(
'handler' => 'support_views_handler_field_last_state_change',
'click sortable' => TRUE,
'sort' => array(
'handler' => 'views_handler_sort',
),
),
);
And later, in hook_views_handlers it does:
/**
* Implements hook_views_handlers().
*/
function support_views_views_handlers() {
return array(
'info' => array(
'path' => drupal_get_path('module', 'support_views'),
),
'handlers' => array(
'views_handler_filter_support_state' => array(
'parent' => 'views_handler_filter_in_operator',
),
'views_handler_filter_support_client' => array(
'parent' => 'views_handler_filter_in_operator',
),
'views_handler_filter_support_priority' => array(
'parent' => 'views_handler_filter_in_operator',
),
'support_views_handler_field_last_state_change' => array(
'parent' => 'views_handler_field_date',
),
),
);
}
Comment | File | Size | Author |
---|---|---|---|
#7 | missing_handler-2393623-4.patch | 3.03 KB | diego21 |
#6 | missing_handler-2393623-3.patch | 3.04 KB | diego21 |
#5 | missing_handler-2393623-2.patch | 2.16 KB | diego21 |
#1 | missing_handler-2393623-1.patch | 2.4 KB | diego21 |
Comments
Comment #1
diego21 CreditAttribution: diego21 commentedHere is a simple patch for that problem, just apply the patch and clear caches.
Comment #2
diego21 CreditAttribution: diego21 commentedComment #3
dawehner... these handlers still all exists, so they actually would not have to be replaced ....
Comment #4
diego21 CreditAttribution: diego21 commentedYou're right, thanks! Besides, it returns this error after change the handler of last_state_change field to views_handler_field_date
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'support_ticket.last_state_change' in 'field list'
Comment #5
diego21 CreditAttribution: diego21 commentedI created a .install file to update the support_ticket database schema:
Then, I implemented hook_node_update to add the last_state_changed info when the ticket is updated. But when a new ticket is created, last_state_changed keeps emty, is that ok? Should I consider that to? Technically when the ticket is create, its state isn't uptaded.
I also updated the patch file.
Comment #6
diego21 CreditAttribution: diego21 commentedAdded changes and new file to a single .patch file.
Comment #7
diego21 CreditAttribution: diego21 commentedFixed trailing whitespaces errors and new blank line at EOF error.
Comment #8
dawehnerI'm sorry, but you should rather fix the handler than updating a table of a different module.
Comment #9
diego21 CreditAttribution: diego21 commentedBut it's nothing wrong with the handler, it's the Views' date handler. I updated that table because support_views module is supported on that module (support), and the timestamp needed by the field last_state_change must be stored in somewhere (at least is what I think).
All other fields implemented in the module are defined in support's schema. Maybe this module would needs its own table, but I think that's not the best approach, right? I mean, a module developed to connect other module with Views shouldn't store extra info.
Thanks for your comments! :D