diff --git a/core/lib/Drupal/Core/EventSubscriber/HtmlResponsePlaceholderStrategySubscriber.php b/core/lib/Drupal/Core/EventSubscriber/HtmlResponsePlaceholderStrategySubscriber.php index 147d51f..ca7f2ac 100644 --- a/core/lib/Drupal/Core/EventSubscriber/HtmlResponsePlaceholderStrategySubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/HtmlResponsePlaceholderStrategySubscriber.php @@ -14,7 +14,13 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** - * HTML response subscriber to allow for different placeholder strategies. + * HTML response subscriber to allow for different placeholder strategies. + * + * This allows core and contrib to coordinate how to render placeholders; + * e.g. an EsiRenderStrategy could replace the placeholders with ESI tags, + * while e.g. a BigPipeRenderStrategy could store the placeholders in a + * BigPipe service and render them after the main content has been sent to + * the client. */ class HtmlResponsePlaceholderStrategySubscriber implements EventSubscriberInterface { diff --git a/core/lib/Drupal/Core/Render/Placeholder/SingleFlushStrategy.php b/core/lib/Drupal/Core/Render/Placeholder/SingleFlushStrategy.php index 61fea0f..d9f8545 100644 --- a/core/lib/Drupal/Core/Render/Placeholder/SingleFlushStrategy.php +++ b/core/lib/Drupal/Core/Render/Placeholder/SingleFlushStrategy.php @@ -11,7 +11,8 @@ * Defines the 'single_flush' placeholder strategy. * * This is designed to be the fallback strategy, so should have the lowest - * priority. + * priority. All placeholders that are not yet replaced at this point will be + * rendered as is and delivered directly. */ class SingleFlushStrategy implements PlaceholderStrategyInterface { diff --git a/core/tests/Drupal/Tests/Core/Render/Placeholder/PlaceholderStrategyManagerTest.php b/core/tests/Drupal/Tests/Core/Render/Placeholder/PlaceholderStrategyManagerTest.php index 387cef5..87c766a 100644 --- a/core/tests/Drupal/Tests/Core/Render/Placeholder/PlaceholderStrategyManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Render/Placeholder/PlaceholderStrategyManagerTest.php @@ -41,7 +41,7 @@ public function providerProcessPlaceholders() { $data = []; // Empty placeholders. - $data[] = [[], [], []]; + $data['empty placeholders'] = [[], [], []]; // Placeholder removing strategy. $placeholders = [ @@ -52,7 +52,7 @@ public function providerProcessPlaceholders() { $prophecy->processPlaceholders($placeholders)->willReturn([]); $dev_null_strategy = $prophecy->reveal(); - $data[] = [[$dev_null_strategy], $placeholders, []]; + $data['placeholder removing strategy'] = [[$dev_null_strategy], $placeholders, []]; // Fake Single Flush strategy. $placeholders = [ @@ -63,7 +63,7 @@ public function providerProcessPlaceholders() { $prophecy->processPlaceholders($placeholders)->willReturn($placeholders); $single_flush_strategy = $prophecy->reveal(); - $data[] = [[$single_flush_strategy], $placeholders, $placeholders]; + $data['fake single flush strategy'] = [[$single_flush_strategy], $placeholders, $placeholders]; // Fake ESI strategy. $placeholders = [ @@ -77,7 +77,7 @@ public function providerProcessPlaceholders() { $prophecy->processPlaceholders($placeholders)->willReturn($result); $esi_strategy = $prophecy->reveal(); - $data[] = [[$esi_strategy], $placeholders, $result]; + $data['fake esi strategy'] = [[$esi_strategy], $placeholders, $result]; // ESI + SingleFlush strategy (ESI replaces all). $prophecy = $this->prophesize('\Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface'); @@ -90,7 +90,7 @@ public function providerProcessPlaceholders() { $prophecy->processPlaceholders([])->shouldNotBeCalled(); $single_flush_strategy = $prophecy->reveal(); - $data[] = [[$esi_strategy, $single_flush_strategy], $placeholders, $result]; + $data['fake esi and single_flush strategy - esi replaces all'] = [[$esi_strategy, $single_flush_strategy], $placeholders, $result]; // ESI + SingleFlush strategy (mixed). $placeholders = [ @@ -118,7 +118,7 @@ public function providerProcessPlaceholders() { $prophecy->processPlaceholders($normal_result)->willReturn($normal_result); $single_flush_strategy = $prophecy->reveal(); - $data[] = [[$esi_strategy, $single_flush_strategy], $placeholders, $result]; + $data['fake esi and single_flush strategy - mixed'] = [[$esi_strategy, $single_flush_strategy], $placeholders, $result]; return $data; }