Commit f88309ad authored by kiz_0987's avatar kiz_0987

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