Commit f88309ad authored by kiz_0987's avatar kiz_0987
Browse files

Add clean urls on breadcrumb (except the main gallery one unfortunately).

Fixed breadcrumb generation for hybrid theme
parent eebfd4f9
...@@ -116,35 +116,35 @@ function gallery_search_page($results) { ...@@ -116,35 +116,35 @@ function gallery_search_page($results) {
/** /**
* Implementation of hook_filter * Implementation of hook_filter
*/ */
function gallery_filter($op, $delta = 0, $format = -1, $text = '') { function gallery_filter($op, $delta = 0, $format = -1, $text = '') {
$path = drupal_get_path('module', 'gallery'); $path = drupal_get_path('module', 'gallery');
require_once($path . '/gallery_filter.inc'); require_once($path . '/gallery_filter.inc');
switch ($op) { switch ($op) {
case 'list' : case 'list' :
return array (0 => t('Gallery2 filter')); return array (0 => t('Gallery2 filter'));
case 'description' : case 'description' :
return t('Allow users to easily reference Gallery2 items from nodes.'); return t('Allow users to easily reference Gallery2 items from nodes.');
case 'process' : case 'process' :
return gallery_filter_process($text); return gallery_filter_process($text);
case 'no cache': case 'no cache':
return !variable_get('gallery_filter_can_cache', 1); return !variable_get('gallery_filter_can_cache', 1);
default : default :
return $text; return $text;
} }
} }
/** /**
* Implementation of hook_filter_tips * Implementation of hook_filter_tips
*/ */
function gallery_filter_tips($delta = 0, $format = -1, $long = false) { function gallery_filter_tips($delta = 0, $format = -1, $long = false) {
$path = drupal_get_path('module', 'gallery'); $path = drupal_get_path('module', 'gallery');
require_once($path . '/gallery_help.inc'); require_once($path . '/gallery_help.inc');
if ($long) { if ($long) {
return gallery_filter_long_tip_translated(); return gallery_filter_long_tip_translated();
} else { } else {
return gallery_filter_short_tip_translated(); return gallery_filter_short_tip_translated();
} }
} }
/** /**
...@@ -215,13 +215,20 @@ function gallery_page() { ...@@ -215,13 +215,20 @@ function gallery_page() {
if (isset($result['themeData'])) { if (isset($result['themeData'])) {
$urlGenerator =& $GLOBALS['gallery']->getUrlGenerator(); $urlGenerator =& $GLOBALS['gallery']->getUrlGenerator();
$breadcrumb = array(l(t('Home'), '')); $breadcrumb = array(l(t('Home'), ''));
foreach ($result['themeData']['parents'] as $parent) { // Some themes (eg hybrid) do not set $result['themeData']['parents']
$parent_title = $parent['title']; if ($result['themeData']['parents']) {
// Simple strip of bbcode (italics) foreach ($result['themeData']['parents'] as $parent) {
$parent_title = str_replace("[i]", "<i>", $parent_title); $parent_title = $parent['title'];
$parent_title = str_replace("[/i]", "</i>", $parent_title); // Simple strip of bbcode (italics)
$breadcrumb[] = '<a href="'.$urlGenerator->generateUrl( $parent_title = str_replace("[i]", "<i>", $parent_title);
array('itemId' => $parent['id'])) .'">'.$parent_title."</a>"; $parent_title = str_replace("[/i]", "</i>", $parent_title);
// Still does not generate a clean url for /gallery (uses index.php?q=gallery)
$link = $urlGenerator->generateUrl(
array('view' => 'core.ShowItem',
'itemId' => $parent['id']),
array('forceFullUrl' => 1));
$breadcrumb[] = l($parent_title, $link);
}
} }
drupal_set_breadcrumb($breadcrumb); drupal_set_breadcrumb($breadcrumb);
} }
......
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