You are here

public function Media::setPublished in Media entity 8

Sets the published status of a media.

Parameters

bool $published: TRUE to set this media to published, FALSE to set it to unpublished.

Return value

\Drupal\media_entity\MediaInterface The called media entity.

Overrides MediaInterface::setPublished

File

src/Entity/Media.php, line 118

Class

Media
Defines the media entity class.

Namespace

Drupal\media_entity\Entity

Code

public function setPublished($published) {
  $this
    ->set('status', $published ? Media::PUBLISHED : Media::NOT_PUBLISHED);
  return $this;
}