Oliver Davies
58d56220de
Update the ordering of the future talks on the talks page so that upcoming talks are shown in chronological order (soonest first), followed by past talks in reverse chronological order (most recent first). This still uses the `created` date for ordering, which is updated automatically on saving the node to match the furthest future talk, but I may want to move that into a custom node property at some point. Fixes #140
24 lines
458 B
Plaintext
24 lines
458 B
Plaintext
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Custom code for talks pages.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Implements hook_views_data_alter().
|
|
*/
|
|
function opd_talks_views_data_alter(array &$data): void {
|
|
$data['node_field_data']['event_sort'] = [
|
|
'title' => t('Custom event sort'),
|
|
'group' => t('Content'),
|
|
'help' => t('Sort events by past/future, then distance from now.'),
|
|
'sort' => [
|
|
'field' => 'created',
|
|
'id' => 'event_sort',
|
|
]
|
|
];
|
|
}
|