Skip to content
Snippets Groups Projects

Basic converter and test

Closes #3498005

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
15 * Converts a single block render array to a custom element.
16 *
17 * @param array $block_build
18 * The block render array.
19 * @param \Drupal\Core\Cache\RefinableCacheableDependencyInterface|null $cache_metadata
20 * Optional object to attach cache metadata to when the block is
21 * empty (cache-only). Pass this to ensure cache metadata from empty
22 * blocks is not lost.
23 *
24 * @return \Drupal\custom_elements\CustomElement|null
25 * The custom element, or NULL if the block is empty and cache metadata
26 * was attached to the provided cache metadata object.
27 */
28 public function convertBlockRenderArray(array $block_build, ?RefinableCacheableDependencyInterface $cache_metadata = NULL): ?CustomElement {
29 // Handle empty cache-only entries.
30 if (isset($block_build['#cache']) && count($block_build) == 1) {
  • Kernel test is very detailed and I think it thoroughly covers the XB to CE conversion.

  • Lio Novelli approved this merge request

    approved this merge request

  • Please register or sign in to reply
    Loading