You are here

public function FlagForList::setOwner in Flag Lists 8

Same name and namespace in other branches
  1. 4.0.x src/Entity/FlagForList.php \Drupal\flag_lists\Entity\FlagForList::setOwner()

File

src/Entity/FlagForList.php, line 111

Class

FlagForList
Defines the Flag for list entity.

Namespace

Drupal\flag_lists\Entity

Code

public function setOwner($owner = NULL) {
  if (!empty($owner)) {
    $this->owner = $owner;
  }
  else {
    $account = \Drupal::currentUser();
    $this->owner = $account
      ->getAccountName();
  }
}