You are here

public static function ViewsAddButtonUser::checkAccess in Views Add Button 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/views_add_button/ViewsAddButtonUser.php \Drupal\views_add_button\Plugin\views_add_button\ViewsAddButtonUser::checkAccess()

Check for access to the appropriate "add" route.

Parameters

string $entity_type: Entity id as a machine name.

string $bundle: The bundle string.

string $context: Entity context string

Return value

bool Whether we have access.

File

src/Plugin/views_add_button/ViewsAddButtonUser.php, line 43

Class

ViewsAddButtonUser
User plugin for Views Add Button.

Namespace

Drupal\views_add_button\Plugin\views_add_button

Code

public static function checkAccess($entity_type, $bundle, $context) {
  $accessManager = \Drupal::service('access_manager');
  return $accessManager
    ->checkNamedRoute('user.admin_create', [], \Drupal::currentUser());
}