function EntityPublishedTrait::setPublished

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityPublishedTrait.php \Drupal\Core\Entity\EntityPublishedTrait::setPublished()
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityPublishedTrait.php \Drupal\Core\Entity\EntityPublishedTrait::setPublished()
  3. 10 core/lib/Drupal/Core/Entity/EntityPublishedTrait.php \Drupal\Core\Entity\EntityPublishedTrait::setPublished()

File

core/lib/Drupal/Core/Entity/EntityPublishedTrait.php, line 54

Class

EntityPublishedTrait
Provides a trait for published status.

Namespace

Drupal\Core\Entity

Code

public function setPublished() {
    $key = $this->getEntityType()
        ->getKey('published');
    $this->set($key, TRUE);
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.