Move farm menu code from farm_admin to new farm_menu module.
This commit is contained in:
parent
c73b27852f
commit
851fb9fe46
|
@ -47,6 +47,7 @@ dependencies[] = farm_fields
|
||||||
dependencies[] = farm_help
|
dependencies[] = farm_help
|
||||||
dependencies[] = farm_log
|
dependencies[] = farm_log
|
||||||
dependencies[] = farm_map
|
dependencies[] = farm_map
|
||||||
|
dependencies[] = farm_menu
|
||||||
dependencies[] = farm_people
|
dependencies[] = farm_people
|
||||||
dependencies[] = farm_quantity
|
dependencies[] = farm_quantity
|
||||||
dependencies[] = farm_taxonomy
|
dependencies[] = farm_taxonomy
|
||||||
|
|
10
farm.install
10
farm.install
|
@ -536,10 +536,16 @@ function farm_update_7024(&$sandbox) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install the new Farm Help, People, and UI modules.
|
* Install the new Farm Help, Menu, People, and UI modules.
|
||||||
*/
|
*/
|
||||||
function farm_update_7025(&$sandbox) {
|
function farm_update_7025(&$sandbox) {
|
||||||
_farm_update_enable_modules(array('farm_help', 'farm_people', 'farm_ui'));
|
$modules = array(
|
||||||
|
'farm_help',
|
||||||
|
'farm_menu',
|
||||||
|
'farm_people',
|
||||||
|
'farm_ui'
|
||||||
|
);
|
||||||
|
_farm_update_enable_modules($modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
* Farm admin install.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements hook_enable().
|
|
||||||
*/
|
|
||||||
function farm_admin_enable() {
|
|
||||||
|
|
||||||
// If Menu module is enabled, create the farm menu.
|
|
||||||
// @see farm_admin_modules_installed()
|
|
||||||
if (module_exists('menu')) {
|
|
||||||
farm_admin_menu_save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements hook_uninstall().
|
|
||||||
*/
|
|
||||||
function farm_admin_uninstall() {
|
|
||||||
|
|
||||||
// Delete the farm menu.
|
|
||||||
if (module_exists('menu')) {
|
|
||||||
if ($farm_menu = menu_load('farm')) {
|
|
||||||
menu_delete($farm_menu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create new farm menu.
|
|
||||||
*/
|
|
||||||
function farm_admin_update_7000(&$sandbox) {
|
|
||||||
|
|
||||||
// If Menu module is enabled, create the farm menu.
|
|
||||||
if (module_exists('menu')) {
|
|
||||||
farm_admin_menu_save();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,17 +4,6 @@
|
||||||
* Code for the Farm Admin feature.
|
* Code for the Farm Admin feature.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements hook_modules_installed().
|
|
||||||
*/
|
|
||||||
function farm_admin_modules_installed($modules) {
|
|
||||||
|
|
||||||
// If the menu module is installed, create the farm menu.
|
|
||||||
if (in_array('menu', $modules)) {
|
|
||||||
farm_admin_menu_save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements hook_permission().
|
* Implements hook_permission().
|
||||||
*/
|
*/
|
||||||
|
@ -101,19 +90,3 @@ function farm_admin_dashboard() {
|
||||||
// Return the output.
|
// Return the output.
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate the farm menu.
|
|
||||||
*
|
|
||||||
* @see farm_admin_enable()
|
|
||||||
* @see farm_admin_install_modules()
|
|
||||||
*/
|
|
||||||
function farm_admin_menu_save() {
|
|
||||||
$t = get_t();
|
|
||||||
$menu = array(
|
|
||||||
'menu_name' => 'farm',
|
|
||||||
'title' => $t('Farm'),
|
|
||||||
'description' => $t('Farm management links'),
|
|
||||||
);
|
|
||||||
menu_save($menu);
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
name = Farm Menu
|
||||||
|
description = Provides a menu for farm pages.
|
||||||
|
core = 7.x
|
||||||
|
package = farmOS
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Farm menu install.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_enable().
|
||||||
|
*/
|
||||||
|
function farm_menu_enable() {
|
||||||
|
|
||||||
|
// If Menu module is enabled, create the farm menu.
|
||||||
|
// @see farm_menu_modules_installed()
|
||||||
|
if (module_exists('menu')) {
|
||||||
|
farm_menu_create();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_uninstall().
|
||||||
|
*/
|
||||||
|
function farm_menu_uninstall() {
|
||||||
|
|
||||||
|
// Delete the farm menu.
|
||||||
|
if (module_exists('menu')) {
|
||||||
|
if ($farm_menu = menu_load('farm')) {
|
||||||
|
menu_delete($farm_menu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Farm menu module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_modules_installed().
|
||||||
|
*/
|
||||||
|
function farm_menu_modules_installed($modules) {
|
||||||
|
|
||||||
|
// If the Menu module is installed, create the farm menu.
|
||||||
|
if (in_array('menu', $modules)) {
|
||||||
|
farm_menu_create();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the farm menu.
|
||||||
|
*
|
||||||
|
* @see farm_menu_enable()
|
||||||
|
* @see farm_menu_install_modules()
|
||||||
|
*/
|
||||||
|
function farm_menu_create() {
|
||||||
|
$t = get_t();
|
||||||
|
$menu = array(
|
||||||
|
'menu_name' => 'farm',
|
||||||
|
'title' => $t('Farm'),
|
||||||
|
'description' => $t('Farm management links'),
|
||||||
|
);
|
||||||
|
menu_save($menu);
|
||||||
|
}
|
Loading…
Reference in New Issue