2 * Implements hook_views_post_build().
4 function {{ machine_name }}_views_post_build(ViewExecutable $view) {
5 // If the exposed field 'type' is set, hide the column containing the content
6 // type. (Note that this is a solution for a particular view, and makes
7 // assumptions about both exposed filter settings and the fields in the view.
8 // Also note that this alter could be done at any point before the view being
10 if ($view->id() == 'my_view' && isset($view->exposed_raw_input['type']) && $view->exposed_raw_input['type'] != 'All') {
11 // 'Type' should be interpreted as content type.
12 if (isset($view->field['type'])) {
13 $view->field['type']->options['exclude'] = TRUE;