Search
 
SCRIPT & CODE EXAMPLE
 

PHP

views_pre_view

function hook_views_pre_view(ViewExecutable $view, $display_id, array &$args) {

  // Modify contextual filters for my_special_view if user has 'my special permission'.
  $account = Drupal::currentUser();
  if ($view
    ->id() == 'my_special_view' && $account
    ->hasPermission('my special permission') && $display_id == 'public_display') {
    $args[0] = 'custom value';
  }
}
Comment

PREVIOUS NEXT
Code Example
Php :: remove column laravel migration 
Php :: php login system 
Php :: db($twoRandomPhotosOfSomePeoples); 
Java :: dependency for spring security 
Java :: android.support.design.widget.coordinatorlayout androidx 
Java :: No Java files found that extend CordovaActivity. 
Java :: java fullscreen jframe 
Java :: java console text color 
Java :: how to play sounds on java 
Java :: how java programm actually run 
Java :: random item from arraylist 
Java :: java execution time 
Java :: java stream find specific element 
Java :: java int to roman 
Java :: java remove empty lines from string 
Java :: groovy base64 encode 
Java :: toast java example 
Java :: how to install java on ubuntu 18.0.4 
Java :: android java increment hashmap value 
Java :: Json web token dependency in Maven 
Java :: reduce opacity of image in imageview in android 
Java :: reading in lines from a file java 
Java :: javafx open file dialog 
Java :: centos install openjdk 11 
Java :: CellStyle change backgroung color java 
Java :: java how to generate guid 
Java :: jfilechooser file filter 
Java :: how to resice image button src 
Java :: java double 2 decimal 
Java :: keytool command sha256 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =