function _social_event_views_update in Open Social 8.9
Same name and namespace in other branches
- 10.3.x modules/social_features/social_event/social_event.module \_social_event_views_update()
- 10.0.x modules/social_features/social_event/social_event.module \_social_event_views_update()
- 10.1.x modules/social_features/social_event/social_event.module \_social_event_views_update()
- 10.2.x modules/social_features/social_event/social_event.module \_social_event_views_update()
Change views filters order.
Parameters
string $view_config: The views config name.
string $display: The views display id.
3 calls to _social_event_views_update()
- social_event_update_8903 in modules/
social_features/ social_event/ social_event.install - Update community events views.
- social_event_update_8904 in modules/
social_features/ social_event/ social_event.install - Update user's events views.
- social_group_update_8902 in modules/
social_features/ social_group/ social_group.install - Update group's event views.
File
- modules/
social_features/ social_event/ social_event.module, line 1102 - The Social event module.
Code
function _social_event_views_update($view_config, $display) {
// Get views config.
$config = \Drupal::configFactory()
->getEditable($view_config);
// Get views config array.
$data = $config
->getRawData();
$filters = $data['display'][$display]['display_options']['filters'];
// Reorder filters.
$new_filters['event_date'] = $filters['event_date'];
unset($filters['event_date']);
$new_filters = array_merge($new_filters, $filters);
// Save new configs.
$data['display'][$display]['display_options']['filters'] = $new_filters;
$config
->setData($data)
->save();
}