EntityTestRenderController.php

Contains \Drupal\entity_test\EntityTestRenderController.

Namespace

Drupal\entity_test

File

drupal/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestRenderController.php
View source
<?php

/**
 * @file
 * Contains \Drupal\entity_test\EntityTestRenderController.
 */
namespace Drupal\entity_test;

use Drupal\Core\Entity\EntityRenderController;

/**
 * Defines an entity render controller for a test entity.
 *
 * @see \Drupal\entity_test\Plugin\Core\Entity\EntityTestRender
 */
class EntityTestRenderController extends EntityRenderController {

  /**
   * Overrides Drupal\Core\Entity\EntityRenderController::buildContent().
   */
  public function buildContent(array $entities, array $displays, $view_mode, $langcode = NULL) {
    parent::buildContent($entities, $displays, $view_mode, $langcode);
    foreach ($entities as $entity) {
      $entity->content['label'] = array(
        '#markup' => check_plain($entity
          ->label()),
      );
      $entity->content['separator'] = array(
        '#markup' => ' | ',
      );
      $entity->content['view_mode'] = array(
        '#markup' => check_plain($view_mode),
      );
    }
  }

}

Classes

Namesort descending Description
EntityTestRenderController Defines an entity render controller for a test entity.