Drupal Views: Remove actions(edit button) on drupal views from view_pre_render hook conditionally

289 views Asked by At

Drupal Views: Remove actions(edit button) on drupal views from view_pre_render hook conditionally:

I am trying to hide/remove the edit button for few records conditionally on a view from the hook view_pre_render.

function member_management_views_pre_render(ViewExecutable $view) {
  if ($view->id() == 'my_view_id') {
    //if(mycondition){
        foreach($view->field as $key => $value) {

                //ACTIONS FIELD NAME IS OPERATIONS 
                //$value->_entity->operations->setValue() = 0;
                //operations->field->handlers->displayhandlers
        }
    //}

  }
}
0

There are 0 answers