You are here

class ReferenceViewController in Bibliography & Citation 2.0.x

Same name and namespace in other branches
  1. 8 modules/bibcite_entity/src/Controller/ReferenceViewController.php \Drupal\bibcite_entity\Controller\ReferenceViewController

Class ReferenceViewController.

@package Drupal\bibcite_entity\Controller

Hierarchy

Expanded class hierarchy of ReferenceViewController

File

modules/bibcite_entity/src/Controller/ReferenceViewController.php, line 17

Namespace

Drupal\bibcite_entity\Controller
View source
class ReferenceViewController extends EntityViewController {

  /**
   * Reference config.
   *
   * @var \Drupal\Core\Config\ImmutableConfig
   */
  protected $config;

  /**
   * {@inheritdoc}
   */
  public function __construct(EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer, ImmutableConfig $config) {
    parent::__construct($entity_type_manager, $renderer);
    $this->config = $config;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {

    /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_manager */
    $entity_manager = $container
      ->get('entity_type.manager');

    /** @var \Drupal\Core\Render\RendererInterface $renderer */
    $renderer = $container
      ->get('renderer');

    /** @var \Drupal\Core\Config\ConfigFactoryInterface $config_factory */
    $config_factory = $container
      ->get('config.factory');
    $config = $config_factory
      ->get('bibcite_entity.reference.settings');
    return new static($entity_manager, $renderer, $config);
  }

  /**
   * {@inheritdoc}
   */
  public function view(EntityInterface $bibcite_reference, $view_mode = 'full') {
    $view_mode = $this->config
      ->get('display_override.reference_page_view_mode');
    return parent::view($bibcite_reference, $view_mode);
  }

  /**
   * {@inheritdoc}
   */
  public function viewRevision(EntityInterface $_entity_revision, $view_mode = 'full') {
    $view_mode = $this->config
      ->get('display_override.reference_page_view_mode');
    return parent::viewRevision($_entity_revision, $view_mode);
  }

  /**
   * Page title callback for a reference revision.
   *
   * @param \Drupal\Core\Entity\EntityInterface $bibcite_reference_revision
   *   The reference revision.
   *
   * @return string
   *   The page title.
   */
  public function revisionTitle(EntityInterface $bibcite_reference_revision = NULL) {
    return $bibcite_reference_revision
      ->label();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
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::trustedCallbacks public static function Lists the trusted callbacks provided by the implementing class. Overrides TrustedCallbackInterface::trustedCallbacks
ReferenceViewController::$config protected property Reference config.
ReferenceViewController::create public static function Instantiates a new instance of this class. Overrides EntityViewController::create
ReferenceViewController::revisionTitle public function Page title callback for a reference revision.
ReferenceViewController::view public function Provides a page to render a single entity. Overrides EntityViewController::view
ReferenceViewController::viewRevision public function Provides a page to render a single entity revision. Overrides EntityViewController::viewRevision
ReferenceViewController::__construct public function Creates an EntityViewController object. Overrides EntityViewController::__construct
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.