diff --git a/core/includes/entity.inc b/core/includes/entity.inc index 0177326..ddf95f3 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -52,7 +52,7 @@ function entity_info_cache_clear() { function entity_render_cache_clear() { $entity_manager = Drupal::entityManager(); foreach ($entity_manager->getDefinitions() as $entity_type => $info) { - if ($entity_manager->hasController($entity_type, 'render')) { + if ($entity_manager->hasController($entity_type, 'view_builder')) { $entity_manager->getViewBuilder($entity_type)->resetCache(); } } diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index ff3ea8a..6b1a788 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -365,7 +365,7 @@ public function changed() { } foreach ($referenced_entity_ids as $entity_type => $entity_ids) { - if (\Drupal::entityManager()->hasController($entity_type, 'render')) { + if (\Drupal::entityManager()->hasController($entity_type, 'view_builder')) { \Drupal::entityManager()->getViewBuilder($entity_type)->resetCache(array_keys($entity_ids)); } } diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index fb77b45..7732895 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -297,7 +297,7 @@ function comment_field_instance_create(FieldInstanceInterface $instance) { */ function comment_field_instance_update(FieldInstanceInterface $instance) { if ($instance->getFieldType() == 'comment') { - \Drupal::entityManager()->getRenderController($instance->entity_type)->resetCache(); + \Drupal::entityManager()->getViewBuilder($instance->entity_type)->resetCache(); } } diff --git a/core/modules/comment/lib/Drupal/comment/CommentFormController.php b/core/modules/comment/lib/Drupal/comment/CommentFormController.php index ecbe5b2..48e420b 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentFormController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentFormController.php @@ -49,7 +49,7 @@ public static function create(ContainerInterface $container) { } /** - * Constructs a new CommentRenderController. + * Constructs a new CommentFormController. * * @param \Drupal\Core\Entity\EntityManager $entity_manager * The entity manager service. @@ -410,6 +410,6 @@ public function save(array $form, array &$form_state) { // Clear the block and page caches so that anonymous users see the comment // they have posted. Cache::invalidateTags(array('content' => TRUE)); - $this->entityManager->getRenderController($entity->entityType())->resetCache(array($entity->id())); + $this->entityManager->getViewBuilder($entity->entityType())->resetCache(array($entity->id())); } } diff --git a/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php b/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php index 9a8260e..b4b3065 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php +++ b/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php @@ -20,7 +20,7 @@ /** * Render controller for comments. */ -class CommentViewBuilder extends EntityViewBuilder implements EntityViewBuilderInterface { +class CommentViewBuilder extends EntityViewBuilder implements EntityViewBuilderInterface, EntityControllerInterface { /** * The entity manager service. @@ -56,7 +56,7 @@ public static function createInstance(ContainerInterface $container, $entity_typ } /** - * Constructs a new CommentRenderController. + * Constructs a new CommentViewBuilder. * * @param string $entity_type * The entity type. @@ -75,7 +75,7 @@ public function __construct($entity_type, EntityManager $entity_manager, FieldIn } /** - * Overrides Drupal\Core\Entity\EntityRenderController::buildContent(). + * Overrides Drupal\Core\Entity\EntityViewBuilder::buildContent(). * * In addition to modifying the content key on entities, this implementation * will also set the comment entity key which all comments carry. diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentDefaultFormatter.php b/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentDefaultFormatter.php index 5ae427f..0c8c229 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentDefaultFormatter.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/field/formatter/CommentDefaultFormatter.php @@ -8,7 +8,7 @@ namespace Drupal\comment\Plugin\field\formatter; use Drupal\comment\CommentStorageControllerInterface; -use Drupal\Core\Entity\EntityRenderControllerInterface; +use Drupal\Core\Entity\EntityViewBuilderInterface; use Drupal\Core\Entity\Field\FieldItemListInterface; use Drupal\Core\Session\AccountInterface; use Drupal\field\Annotation\FieldFormatter; @@ -49,9 +49,9 @@ class CommentDefaultFormatter extends FormatterBase implements ContainerFactoryP /** * The comment render controller. * - * @var \Drupal\Core\Entity\EntityRenderControllerInterface + * @var \Drupal\Core\Entity\EntityViewBuilderInterface */ - protected $renderController; + protected $viewBuilder; /** * {@inheritdoc} @@ -66,7 +66,7 @@ public static function create(ContainerInterface $container, array $configuratio $configuration['view_mode'], $container->get('current_user'), $container->get('entity.manager')->getStorageController('comment'), - $container->get('entity.manager')->getRenderController('comment') + $container->get('entity.manager')->getViewBuilder('comment') ); } @@ -89,12 +89,12 @@ public static function create(ContainerInterface $container, array $configuratio * The current user. * @param \Drupal\comment\CommentStorageControllerInterface * The comment storage controller. - * @param \Drupal\Core\Entity\EntityRenderControllerInterface - * The comment render controller. + * @param \Drupal\Core\Entity\EntityViewBuilderInterface + * The comment view builder. */ - public function __construct($plugin_id, array $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, AccountInterface $current_user, CommentStorageControllerInterface $comment_storage_controller, EntityRenderControllerInterface $comment_render_controller) { + public function __construct($plugin_id, array $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, AccountInterface $current_user, CommentStorageControllerInterface $comment_storage_controller, EntityViewBuilderInterface $comment_view_builder) { parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode); - $this->renderController = $comment_render_controller; + $this->viewBuilder = $comment_view_builder; $this->storageController = $comment_storage_controller; $this->currentUser = $current_user; } @@ -129,7 +129,7 @@ public function viewElements(FieldItemListInterface $items) { if ($cids = comment_get_thread($entity, $field_name, $mode, $comments_per_page)) { $comments = $this->storageController->loadMultiple($cids); comment_prepare_thread($comments); - $build = $this->renderController->viewMultiple($comments); + $build = $this->viewBuilder->viewMultiple($comments); $build['pager']['#theme'] = 'pager'; $output['comments'] = $build; } diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php index 7ec721f..a4ed5f1 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php @@ -307,7 +307,7 @@ function testCommentFunctionality() { )); // We've changed role permissions, so need to reset render cache. // @todo Revisit after https://drupal.org/node/2099105 - \Drupal::entityManager()->getRenderController('entity_test')->resetCache(array($this->entity->id())); + \Drupal::entityManager()->getViewBuilder('entity_test')->resetCache(array($this->entity->id())); $this->drupalGet('entity-test/' . $this->entity->id()); $this->assertPattern('@