You are here

class MediaViewController in Media Expire 8

Same name and namespace in other branches
  1. 8.2 src/Controller/MediaViewController.php \Drupal\media_expire\Controller\MediaViewController

Extends EntityViewController to overwrite the view method.

Hierarchy

Expanded class hierarchy of MediaViewController

File

src/Controller/MediaViewController.php, line 11

Namespace

Drupal\media_expire\Controller
View source
class MediaViewController extends EntityViewController {

  /**
   * {@inheritdoc}
   */
  public function view(EntityInterface $media, $view_mode = 'full') {
    $page = $this->entityManager
      ->getViewBuilder($media
      ->getEntityTypeId())
      ->view($media, $view_mode);
    $page['#pre_render'][] = [
      $this,
      'buildTitle',
    ];
    $page['#entity_type'] = $media
      ->getEntityTypeId();
    if (empty($page['#' . $page['#entity_type']])) {
      $page['#' . $page['#entity_type']] = $media;
    }
    return $page;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeprecatedServicePropertyTrait::__get public function Allows to access deprecated/removed properties.
EntityViewController::$deprecatedProperties protected property
EntityViewController::$entityTypeManager protected property The entity type manager.
EntityViewController::$renderer protected property The renderer service.
EntityViewController::buildTitle public function Pre-render callback to build the page title.
EntityViewController::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create 2
EntityViewController::trustedCallbacks public static function Lists the trusted callbacks provided by the implementing class. Overrides TrustedCallbackInterface::trustedCallbacks
EntityViewController::viewRevision public function Provides a page to render a single entity revision.
EntityViewController::__construct public function Creates an EntityViewController object. 2
MediaViewController::view public function Provides a page to render a single entity. Overrides EntityViewController::view
TrustedCallbackInterface::THROW_EXCEPTION constant Untrusted callbacks throw exceptions.
TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION constant Untrusted callbacks trigger silenced E_USER_DEPRECATION errors.
TrustedCallbackInterface::TRIGGER_WARNING constant Untrusted callbacks trigger E_USER_WARNING errors.