Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / views_post_build.twig
1 /**
2  * Implements hook_views_post_build().
3  */
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
9   // rendered.)
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;
14     }
15   }
16 }