You are here

public function Entity::userCanVote in Like & Dislike 7

File

src/Model/Entity.php, line 66

Class

Entity
@file

Namespace

Drupal\like_and_dislike\Model

Code

public function userCanVote($account = NULL) {
  if ($this->entity_type == 'node') {
    $access = user_access('like/dislike any ' . $this->bundle . ' nodes', $account);
  }
  else {
    if ($this->entity_type == 'comment') {
      $access = user_access('like/dislike any ' . $this->bundle . ' comments', $account);
    }
  }
  return $access;
}