Untitled
unknown
plain_text
2 years ago
957 B
4
Indexable
/** * Implements hook_views_pre_render(). */ function my_custom_module_views_pre_render(ViewExecutable $view) { // Check if this is the specific view you want to modify. if ($view->id() === 'your_view_id') { // Get the main table of the view. $base_table = $view->storage->get('base_table'); // Add a relationship to the revision table to get the latest revision of each node. $view->query->addRelationship($base_table . '__revision', $base_table . '.vid', $base_table . '__revision.vid'); // Add the workflow transition history field to the view. $view->addField('your_table_name', 'field_workflow_history_value', 'field_workflow_history_value', [ 'label' => 'Latest Workflow Transition History', 'alias' => 'latest_workflow_transition', 'settings' => [ 'group_column' => 'entity_id', // To group by node ID. 'group_type' => 'MAX', // To get the latest entry. ], ]); } }
Editor is loading...