You are here

public function EditableFieldsHelper::checkAccess in Editable Fields 1.0.x

Same name and namespace in other branches
  1. 8 src/services/EditableFieldsHelper.php \Drupal\editablefields\services\EditableFieldsHelper::checkAccess()

Checks if the user can use "editablefields" formatter.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: Entity object.

Return value

bool TRUE if the user can use "editablefields" formatret.

Overrides EditableFieldsHelperInterface::checkAccess

File

src/services/EditableFieldsHelper.php, line 86

Class

EditableFieldsHelper
Class EditableFieldsHelper.

Namespace

Drupal\editablefields\services

Code

public function checkAccess(EntityInterface $entity) {
  $can_edit = $entity
    ->access('edit');
  $can_use = $this->currentUser
    ->hasPermission(self::PERMISSION);
  return $can_edit && $can_use;
}