You are here

rocket_chat.module in Rocket.Chat 7

Same filename and directory in other branches
  1. 8.2 rocket_chat.module
  2. 8 rocket_chat.module
  3. 7.2 rocket_chat.module

Rocket.Chat Livechat Module.

Created by PhpStorm. User: Sysosmaster Date: 30/12/16 Time: 14:01.

File

rocket_chat.module
View source
<?php

/**
 * @file
 * Rocket.Chat Livechat Module.
 *
 * Created by PhpStorm.
 * User: Sysosmaster
 * Date: 30/12/16
 * Time: 14:01.
 */
use RocketChat\RocketChat;

/**
 * Implements hook_page_alter().
 * @see \hook_page_alter()
 * @param $page
 *   Current Render array for a page.
 */
function rocket_chat_page_alter(&$page) {

  // Make sure the Included class File is loaded.
  module_load_include('class.inc', 'rocket_chat', 'RocketChat');
  RocketChat::hookPageAlter($page);
}

/**
 * Implements hook_help().
 * @see \hook_help()
 * @param $path
 *   Path to render help for.
 * @param $arg
 *   Arguments on this Path.
 * @return string
 */
function rocket_chat_help($path, $arg) {

  // Make sure the Included class File is loaded.
  module_load_include('class.inc', 'rocket_chat', 'RocketChat');
  return RocketChat::renderHelpPage($path, $arg);
}

/**
 * Admin Page Render.
 *
 * @return array
 *   Drupal render Array for the admin page.
 */
function rocket_chat_admin_page() {

  // Make sure the Included class File is loaded.
  module_load_include('class.inc', 'rocket_chat', 'RocketChat');
  return RocketChat::renderAdminPage();
}

/**
 * Implements hook_menu().
 * @see \hook_menu()
 */
function rocket_chat_menu() {
  $menu = array(
    'title' => 'Rocket.Chat Settings',
    'description' => 'Do your Rocket.Chat configuration here',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'rocket_chat_admin_page',
    ),
    'access arguments' => array(
      'rocket_chat admin',
    ),
    'type' => MENU_NORMAL_ITEM,
  );
  $items['admin/config/services/rocket_chat'] = $menu;
  return $items;
}

/**
 * Implements hook_permission().
 * @see \hook_permission()
 */
function rocket_chat_permission() {
  return array(
    'rocket_chat admin' => array(
      'title' => t('Access Rocket.Chat configuration menu'),
      'description' => t('Be able to set the Rocket.Chat Server Settings.'),
      'restrict access' => TRUE,
    ),
  );
}

Functions