You are here

function skinr_ui_entity_view in Skinr 8.2

Implements hook_entity_view().

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

File

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

Code

function skinr_ui_entity_view(array &$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode, $langcode) {

  // Add contextual links for node types.
  if ($entity
    ->getEntityTypeId() == 'node') {
    $build['#contextual_links']['skinr'] = array(
      'route_parameters' => array(
        'element_type' => 'node',
        'element' => $entity
          ->bundle(),
        'theme' => \Drupal::theme()
          ->getActiveTheme()
          ->getName(),
      ),
    );
  }
}