You are here

function lightning_layout_preprocess_block in Lightning Layout 8.2

Implements template_preprocess_block().

File

./lightning_layout.module, line 107
Contains layout functionality for Lightning.

Code

function lightning_layout_preprocess_block(array &$variables) {

  // We need to check for the presence of the actual block content entity,
  // because it might not exist. For example, if the inline block was deployed
  // in config, but the block content was not -- which is entirely likely, since
  // core has no mechanism to deploy content -- we'll try to call uuid() on
  // NULL, which is a fatal error.
  if ($variables['base_plugin_id'] === 'inline_block' && isset($variables['content']['#block_content'])) {
    $variables['attributes']['data-inline-block-uuid'] = $variables['content']['#block_content']
      ->uuid();
  }
}