You are here

protected function BlocksRendererHelper::addPropertiesToRender in Gutenberg 8

Same name and namespace in other branches
  1. 8.2 src/BlocksRendererHelper.php \Drupal\gutenberg\BlocksRendererHelper::addPropertiesToRender()

Add attributes and contextual links to render array.

Parameters

array $render: Render array.

array $content: Block build content.

1 call to BlocksRendererHelper::addPropertiesToRender()
BlocksRendererHelper::getRenderFromBlockPlugin in src/BlocksRendererHelper.php
Return render array for given block plugin.

File

src/BlocksRendererHelper.php, line 132

Class

BlocksRendererHelper
Class BlocksRendererHelper.

Namespace

Drupal\gutenberg

Code

protected function addPropertiesToRender(array &$render, array &$content) {

  // Bubble block attributes up if possible.
  // This allows modules like Quickedit to function.
  // See \Drupal\block\BlockViewBuilder::preRender() for reference.
  if ($content !== NULL && !Element::isEmpty($content)) {
    foreach ([
      '#attributes',
      '#contextual_links',
    ] as $property) {
      if (isset($content[$property])) {
        $render[$property] += $content[$property];
        unset($content[$property]);
      }
    }
  }
}