nodes filter date range
This commit is contained in:
parent
5bc4992a61
commit
31d1c745b8
@ -175,6 +175,18 @@ class NodesController extends ControllerBase implements ContainerInjectionInterf
|
||||
$sortby = 'created';
|
||||
}
|
||||
|
||||
/* filter creation date range: ?start_date=2023-01-01&end_date=2025-12-31 */
|
||||
if ($request->get('start_date') && $request->get('end_date')) {
|
||||
$startDate = $request->get('start_date');
|
||||
$endDate = $request->get('end_date');
|
||||
if ($startDate && $endDate) {
|
||||
$startDate = strtotime($startDate);
|
||||
$endDate = strtotime($endDate);
|
||||
$query->condition('created', $startDate, '>=');
|
||||
$query->condition('created', $endDate, '<=');
|
||||
}
|
||||
}
|
||||
|
||||
/* execute query to get node ids */
|
||||
$nodeIds = $query
|
||||
->condition('type', self::NODE_TYPE)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user