function hook_social_event_content_block_date_range_alter in Open Social 10.1.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_content_block/modules/social_event_content_block/social_event_content_block.api.php \hook_social_event_content_block_date_range_alter()
- 8.8 modules/social_features/social_content_block/modules/social_event_content_block/social_event_content_block.api.php \hook_social_event_content_block_date_range_alter()
- 10.3.x modules/social_features/social_content_block/modules/social_event_content_block/social_event_content_block.api.php \hook_social_event_content_block_date_range_alter()
- 10.0.x modules/social_features/social_content_block/modules/social_event_content_block/social_event_content_block.api.php \hook_social_event_content_block_date_range_alter()
- 10.2.x modules/social_features/social_content_block/modules/social_event_content_block/social_event_content_block.api.php \hook_social_event_content_block_date_range_alter()
Change the filter range for a content list block of events.
Parameters
array $range: An array containing a `start` and `end` value that can be set to control the start and end dates of the result.
string $value: The value that the user chose in the date filter value.
1 invocation of hook_social_event_content_block_date_range_alter()
- EventContentBlock::query in modules/
social_features/ social_content_block/ modules/ social_event_content_block/ src/ Plugin/ ContentBlock/ EventContentBlock.php - Create filtering query.
File
- modules/
social_features/ social_content_block/ modules/ social_event_content_block/ social_event_content_block.api.php, line 17 - Hooks for the Social Event Content Block module.
Code
function hook_social_event_content_block_date_range_alter(array &$range, $value) {
// We only care about the 'example' choice, other choices are handled by other
// modules.
if ($value === 'example') {
// Only show events that occur on april 1st of this year.
$range['start'] = new DateTime('1 april this year 00:00');
$range['end'] = new DateTime('1 april this year 23:59');
}
}