openlucius-2.0.0-alpha3/modules/apps/ol_stream/ol_stream.module

modules/apps/ol_stream/ol_stream.module
<?php

/**
 * @file
 * Contains lus_stream.module.
 */

/**
 * Implements hook_theme().
 */
function ol_stream_theme() {
  return [
    'stream_wrapper' => [
      'variables' => [
        'vars' => NULL,
      ],
      'template' => 'stream-wrapper',
    ],
    'stream_item' => [
      'variables' => [
        'vars' => NULL,
      ],
      'template' => 'stream-item',
    ],
  ];
}

/**
 * Implements hook_add_ol_section()
 * @param $sections
 */
function ol_stream_add_ol_section(&$sections){
  $sections['stream'] = array('label' => t('Stream'), 'path' => t('stream'), 'weight' => 0);
}

/**
 * Needed to load the node_server dynamically,
 *   based on OpenLucius admin settings (admin/config/openlucius).
 *
 * Implements hook_library_info_build()
 */
function ol_stream_library_info_build() {
  $node_server = \Drupal::config('ol_main.admin_settings')->get('nodejs_server_url');
  $libraries = [];
  $libraries['node_server'] = [
    'version' => '1.x',
    'header' => true,
    'js' => [
       $node_server.'/socket.io/socket.io.js' => [
        'type' => 'external',
        'weight' => '-20',
        'attributes' => ['defer' => true],
      ],
    ],
  ];
  return $libraries;
}

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

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