Commit a73cb3fb authored by profix898's avatar profix898

- feature: add "Your Album" link item to menu (#269398)

parent 1cbabca0
......@@ -33,6 +33,40 @@ function gallery_menu_gallery_init_alter($params, $context) {
}
}
/**
* Implementation of hook_menu().
*/
function gallery_menu_menu() {
$items = array();
if (variable_get('gallery_valid', 0) && variable_get('gallery_menu_useralbum', 0)) {
$items['useralbum'] = array(
'title' => 'Your Album',
'description' => 'Go to your Gallery2 useralbum.',
'access callback' => 'gallery_menu_useralbum_access',
'page callback' => 'gallery_menu_useralbum'
);
}
return $items;
}
/**
* Function gallery_menu_useralbum_access().
*/
function gallery_menu_useralbum_access() {
require_once(drupal_get_path('module', 'gallery') .'/gallery_user.inc');
return (user_access('access gallery') && gallery_user_useralbum());
}
/**
* Function gallery_menu_useralbum().
*/
function gallery_menu_useralbum() {
require_once(drupal_get_path('module', 'gallery') .'/gallery_user.inc');
$url = gallery_user_useralbum();
drupal_goto($url);
}
/**
* Implementation of hook_menu_alter().
*/
......@@ -254,6 +288,14 @@ function _gallery_menu_settings() {
'#options' => _gallery_range_array(1, MENU_MAX_PARTS),
'#description' => 'Depth of album hierarchy to include.'
);
$useralbum = (gallery_single_plugin_status('useralbum') == GALLERY_PLUGIN_ENABLED);
$form['menu']['gallery_menu_useralbum'] = array(
'#type' => 'checkbox',
'#title' => t('Add menu item for \'UserAlbum\''),
'#default_value' => $useralbum ? variable_get('gallery_menu_useralbum', 0) : FALSE,
'#description' => t('Adds a menu link to the navigation menu that points to a user\'s useralbum.'),
'#disabled' => !$useralbum
);
$form['menu']['rebuild_btn'] = array(
'#type' => 'submit',
'#value' => t('Rebuild menu'),
......
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