Commit ac6abc00 authored by RoSk0's avatar RoSk0

Added "CRM Core Menu".

Added "CRM Core Menu" to crm_ui module and link to Dashboard to it.
Added "Contacts" and "Reports" links to "CRM Core Menu".
parent cd9793c7
<?php
/**
* Implements hook_install().
* Implements hook_enable().
*/
function crm_core_contact_ui_install() {
$plid = crm_ui_get_crm_mlid();
function crm_core_contact_ui_enable() {
$item = array(
'link_path' => 'crm/contact',
'link_title' => 'Contacts',
'menu_name' => 'navigation',
'plid' => $plid,
'weight' => 2,
'menu_name' => 'crm-core-menu',
'weight' => 1,
);
menu_link_save($item);
}
\ No newline at end of file
}
/**
* Implements hook_disable().
*/
function crm_core_contact_ui_disable() {
$links = menu_load_links('crm-core-menu');
foreach ($links as $link) {
if ($link['link_path'] == 'crm/contact') {
menu_link_delete($link['mlid']);
}
}
}
<?php
/**
* Implements hook_enable().
*/
function crm_core_report_enable() {
$item = array(
'link_path' => 'crm/reports',
'link_title' => 'Reports',
'menu_name' => 'crm-core-menu',
'weight' => 2,
);
menu_link_save($item);
}
/**
* Implements hook_disable().
*/
function crm_core_report_disable() {
$links = menu_load_links('crm-core-menu');
foreach ($links as $link) {
if ($link['link_path'] == 'crm/reports') {
menu_link_delete($link['mlid']);
}
}
}
......@@ -5,19 +5,42 @@
*/
function crm_ui_install() {
db_query("UPDATE {system} SET weight = 15 WHERE name = 'crm_ui'");
$menus = crm_core_ui_get_menus();
foreach($menus as $menu) {
menu_save($menu);
}
// Rebuild menu so Activity Types menu element will be placed under CRM.
menu_cache_clear_all();
menu_rebuild();
}
/**
* Implements hook_enable().
*/
function crm_ui_enable() {
db_delete('block')->condition('delta', 'crm-core-menu')->execute();
$fields = array( 'module', 'delta', 'theme', 'status', 'weight', 'region', 'custom', 'visibility', 'pages', 'title', 'cache');
$values = array( 'menu', 'crm-core-menu', 'bartik', '1', '0', 'sidebar_first', '0', '0', '', '', '-1');
db_insert('block')->fields($fields, $values)->execute();
$plid = crm_ui_get_crm_mlid();
$item = array(
'link_path' => 'crm/dashboard',
'link_path' => 'crm',
'link_title' => 'Dashboard',
'menu_name' => 'navigation',
'plid' => $plid,
'weight' => 1,
'menu_name' => 'crm-core-menu',
'weight' => 0,
);
menu_link_save($item);
}
/**
* Implements hook_disable().
*/
function crm_ui_disable() {
db_delete('block')->condition('delta', 'crm-core-menu')->execute();
variable_del('crm_ui_plid');
$links = menu_load_links('crm-core-menu');
foreach ($links as $link) {
if ($link['link_path'] == 'crm') {
menu_link_delete($link['mlid']);
}
}
}
......@@ -80,13 +80,6 @@ function crm_ui_permission() {
);
}
/**
* Implements hook_disable().
*/
function crm_ui_disable() {
variable_del('crm_ui_plid');
}
/**
* Implements hook_theme().
*/
......@@ -218,4 +211,21 @@ function crm_ui_get_crm_mlid() {
}
return $plid;
}
\ No newline at end of file
}
/**
* Contains custom menu definitions of CRM Core.
*
* @return array
* Assoc array of menu items, keyed by menu name.
*/
function crm_core_ui_get_menus() {
$t = get_t();
return array(
'crm-core-menu' => array(
'menu_name' => 'crm-core-menu',
'title' => $t('CRM Core Menu'),
'description' => $t('Provides access to various features and functions within CRM Core.'),
)
);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment