niobi-8.x-2.0-alpha4/modules/niobi_group_dashboards/niobi_group_dashboards.module

modules/niobi_group_dashboards/niobi_group_dashboards.module
<?php

/**
 * @file
 * Contains niobi_group_dashboards.module.
 */

use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function niobi_group_dashboards_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    // Main module help for the niobi_group_dashboards module.
    case 'help.page.niobi_group_dashboards':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('Provides base dashboards for Niobi Research Center') . '</p>';
      return $output;

    default:
  }
}

/**
 * Implements hook_entity_extra_field_info() to add the view fields to relevant entities
 */
function niobi_group_dashboards_entity_extra_field_info() {
  $ret = array();

  $ret['group']['niobi_group']['display']['niobi_group_dashboard'] = [
    'label' => t('Group Dashboard'),
    'description' => t('Group Dashboard'),
    'weight' => 10,
  ];

  return $ret;
}

/**
 * Implements hook_ENTITY_TYPE_view().
 */
function niobi_group_dashboards_group_view(array &$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) {
  if ($display->getComponent('niobi_group_dashboard')) {
    $build['niobi_group_dashboard'] = [
      '#theme' => 'ajax_dashboard',
      '#id' => 'niobi_group_dashboard',
      '#params' => ['group' => $entity->id()]
    ];
  }
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc