[ 'base hook' => 'html', ], ]; } /** * Implements hook_farm_dashboard_panes(). */ function farm_ui_map_farm_dashboard_panes() { return [ 'dashboard_map' => [ 'block' => 'dashboard_map', 'region' => 'top', ], ]; } /** * Implements hook_module_implements_alter(). */ function farm_ui_map_module_implements_alter(&$implementations, $hook) { // Ensure that this module's hook_views_pre_render() runs first. if ($hook == 'views_pre_render') { $module = 'farm_ui_map'; $group = $implementations[$module]; unset($implementations[$module]); $implementations = array_merge([$module => $group], $implementations); } } /** * Implements hook_ENTITY_TYPE_view(). */ function farm_ui_map_asset_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) { /** @var \Drupal\farm_entity\Plugin\Asset\AssetType\AssetTypeInterface $entity */ // Bail if not the map_popup view mode. if ($view_mode !== 'map_popup') { return $build; } // Build link to view logs referencing the asset. $url = Url::fromRoute('view.farm_log.page_asset', ['asset' => $entity->id(), 'log_type' => 'all']); $build['logs_links'] = [ '#type' => 'link', '#title' => t('View logs'), '#url' => $url, '#weight' => -100, ]; return $build; }