public function FacetsDateHandler::extractActiveItems in Facets 8
Extracts "start" and "end" dates from an active item.
Parameters
string $item: The active item to extract the dates.
Return value
mixed Returns FALSE if no item found and an array with the dates if the dates were extracted as expected.
File
- src/
Utility/ FacetsDateHandler.php, line 407
Class
- FacetsDateHandler
- Dates Handler service.
Namespace
Drupal\facets\UtilityCode
public function extractActiveItems($item) {
$active_item = [];
if (preg_match(static::FACETS_REGEX_DATE_RANGE, $item, $matches)) {
$active_item['start'] = [
'timestamp' => strtotime($matches[1]),
'iso' => $matches[1],
];
$active_item['end'] = [
'timestamp' => strtotime($matches[8]),
'iso' => $matches[8],
];
return $active_item;
}
return FALSE;
}