You are here

class DefaultController in Hierarchical Term Formatter 8

Controller used for previewing nodes in a view mode.

Hierarchy

Expanded class hierarchy of DefaultController

File

tests/modules/hierarchical_term_formatter_test/src/Controller/DefaultController.php, line 13

Namespace

Drupal\hierarchical_term_formatter_test\Controller
View source
class DefaultController extends NodeViewController {

  /**
   * Provides a page to render a single entity.
   *
   * @param \Drupal\node\NodeInterface $node
   *   The node to be rendered.
   * @param \Drupal\Core\Entity\EntityDisplayModeInterface $view_mode
   *   The view mode that should be used to display the entity.
   *
   * @return array
   *   A render array as expected by drupal_render().
   */
  public function preview(NodeInterface $node, EntityDisplayModeInterface $view_mode) {
    if ($view_mode
      ->getTargetType() == 'node') {
      preg_match('/\\.(.*)/', $view_mode
        ->id(), $matches);
      return parent::view($node, $matches[1]);
    }
    throw new NotFoundHttpException();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DefaultController::preview public function Provides a page to render a single entity.
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::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.
NodeViewController::$currentUser protected property The current user.
NodeViewController::$entityRepository protected property The entity repository service.
NodeViewController::create public static function Instantiates a new instance of this class. Overrides EntityViewController::create
NodeViewController::title public function The _title_callback for the page that renders a single node.
NodeViewController::view public function Provides a page to render a single entity. Overrides EntityViewController::view
NodeViewController::__construct public function Creates an NodeViewController 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.