You are here

function skinr_ui_block_view_alter in Skinr 8.2

Implements hook_block_view_alter().

@todo Abstract into something more generic or move into skinr block plugin.

File

skinr_ui/skinr_ui.module, line 168
Handles Skinr UI functionality allowing users to apply skins to their site.

Code

function skinr_ui_block_view_alter(array &$build, \Drupal\Core\Block\BlockPluginInterface $block) {

  // Add contextual links for blocks.
  // If empty it might indicate a block with no content.
  if (isset($build['#id'])) {
    $build['#contextual_links']['skinr'] = array(
      'route_parameters' => array(
        'element_type' => 'block',
        'element' => $build['#id'],
        'theme' => \Drupal::theme()
          ->getActiveTheme()
          ->getName(),
      ),
    );
  }
}