diff --git a/web/modules/custom/talks/src/Plugin/views/sort/Event.php b/web/modules/custom/talks/src/Plugin/views/sort/Event.php deleted file mode 100644 index 8899899..0000000 --- a/web/modules/custom/talks/src/Plugin/views/sort/Event.php +++ /dev/null @@ -1,69 +0,0 @@ -time = $time; - } - - public static function create( - ContainerInterface $container, - array $configuration, - $pluginId, - $pluginDefinition - ) { - return new static( - $configuration, - $pluginId, - $pluginDefinition, - $container->get('datetime.time') - ); - } - - public function query(): void { - $this->ensureMyTable(); - - $currentDate = Carbon::parse('today')->getTimestamp(); - - $dateAlias = "$this->tableAlias.$this->realField"; - - // Is this event in the past? - $this->query->addOrderBy( - NULL, - sprintf("%d > %s", $currentDate, $dateAlias), - $this->options['order'], - "in_past" - ); - - // How far in the past/future is this event? - $this->query->addOrderBy( - NULL, - sprintf('ABS(%s - %d)', $dateAlias, $currentDate), - $this->options['order'], - "distance_from_now" - ); - } - -}