Access to block edit icon I am trying to create a solution programmatically where I can give access to edit a particular block to a user.

I know using hook_entity_access() I can grant permission to the user to access the block, But the block doesn't show the "edit" icon which I need to help the user to navigate to the edit page.
I found the solution for it.

to reach to the edit button hook_entity_access() is the correct Hook but to provide access to that block content, we first need access to class

Drupal\Core\Access\AccessResult


then to provide access we need to return 

AccessResult::allowed()


A complete example where we might want to give access to a block_content would look like this.

Use Drupal\Core\Entity\EntityInterface;
Use Drupal\Core\Session\AccountInterface;
Use Drupal\Core\Access\AccessResult;

function block_user_access_entity_access(EntityInterface $entity, $operation, AccountInterface $account) {

  if($entity-&gt;getEntityTypeId() == 'block_content'){
    return AccessResult::allowed();
  }
}