You are here

protected function PanelsIPEBlockRendererTrait::bubbleBlockAttributes in Panels 8.3

Same name and namespace in other branches
  1. 8.4 panels_ipe/src/PanelsIPEBlockRendererTrait.php \Drupal\panels_ipe\PanelsIPEBlockRendererTrait::bubbleBlockAttributes()

Bubble block attributes up if possible. This allows modules like Quickedit to function.

Parameters

array $build: The Block render array.

See also

\Drupal\block\BlockViewBuilder::preRender for reference.

2 calls to PanelsIPEBlockRendererTrait::bubbleBlockAttributes()
PanelsIPEBlockPluginForm::submitForm in panels_ipe/src/Form/PanelsIPEBlockPluginForm.php
Form submission handler.
PanelsIPEPageController::getBlock in panels_ipe/src/Controller/PanelsIPEPageController.php
Gets a single Block from the current Panels Display. Uses TempStore.

File

panels_ipe/src/PanelsIPEBlockRendererTrait.php, line 69

Class

PanelsIPEBlockRendererTrait
Provides methods to render Blocks for display in Panels IPE.

Namespace

Drupal\panels_ipe

Code

protected function bubbleBlockAttributes(&$build) {

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