Skip to content

Commit

Permalink
added validation to current user
Browse files Browse the repository at this point in the history
  • Loading branch information
yeniatencio committed Oct 17, 2024
1 parent 3ca1708 commit e4dd458
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,14 @@ public function viewsForm(&$form, FormStateInterface $form_state) {
}

// Removed delete option for approver role.
$roles = $current_user->getRoles();
if (
in_array('approver', $roles) &&
isset($form['header']['node_bulk_form']['action']['#options']['node_delete_action'])
) {
unset($form['header']['node_bulk_form']['action']['#options']['node_delete_action']);
if ($current_user) {
$roles = $current_user->getRoles();
if (
in_array('approver', $roles) &&
isset($form['header']['node_bulk_form']['action']['#options']['node_delete_action'])
) {
unset($form['header']['node_bulk_form']['action']['#options']['node_delete_action']);
}
}
}

}

0 comments on commit e4dd458

Please sign in to comment.