Commit 39413e87 authored by Alberto Ortega's avatar Alberto Ortega
Browse files

Issue #3272423: access return object or bool depending on return_as_object value

parent a83bded1
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -174,14 +174,12 @@ class VboEnqueue extends ViewsBulkOperationsActionBase implements ContainerFacto
   * {@inheritdoc}
   */
  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
    if ($account->hasPermission('views bulk operations enqueue')) {
      $valid = TRUE;
    }
    else {
    $access = AccessResult::allowedIfHasPermission($account, 'views bulk operations enqueue');
    if ($access->isAllowed() === FALSE) {
      $this->messenger()->addWarning($this->t("You don't have enough permissions to enqueue items."));
      $valid = FALSE;
    }
    return $valid;

    return $return_as_object ? $access : $access->isAllowed();
  }

  /**