You are here

protected function MediaForm::prepareEntity in Media entity 8

File

src/MediaForm.php, line 30

Class

MediaForm
Form controller for the media edit forms.

Namespace

Drupal\media_entity

Code

protected function prepareEntity() {
  parent::prepareEntity();
  $media = $this->entity;

  // If this is a new media, fill in the default values.
  if ($media
    ->isNew()) {
    $media
      ->setPublisherId($this
      ->currentUser()
      ->id());
    $media
      ->setCreatedTime(REQUEST_TIME);
  }
}