Skip to content
Snippets Groups Projects

Adding things for breadcrumbs on change notices and issues and their respective views and such

+ 25
7
@@ -303,7 +303,7 @@ function drupalorg_menu() {
];
foreach ($paths as $path) {
$items[$path] = [
'title' => $node_types[$project_type]->name,
'title' => drupalorg_project_node_type_label($project_type, 'plural'),
'description' => '',
'page callback' => 'drupalorg_project_browse_page',
'page arguments' => [$node_types[$project_type]],
@@ -1635,7 +1635,7 @@ function drupalorg_block_view($delta, $block = NULL) {
];
case 'book-listing-info':
if ((($node = menu_get_object()) && $node->type == 'book_listing') || drupalorg_crosssite_child_of('books')) {
if ((($node = menu_get_object()) && $node->type == 'book_listing') || current_path() === 'books') {
return array(
'content' => '<p>' . t('Drupal.org’s online content is © 2000-!year by the individual contributors and can be used in accordance with the <a href="@ccl_url">Creative Commons License, Attribution-ShareAlike 2.0</a>. Book descriptions are generally copyrighted by the book author or publisher, and are added to this web site with permission.', array('!year' => date('Y'), '@ccl_url' => url('node/14307'))) . '</p>',
);
@@ -1643,7 +1643,7 @@ function drupalorg_block_view($delta, $block = NULL) {
break;
case 'book-listing-link':
if ((($node = menu_get_object()) && $node->type == 'book_listing') || drupalorg_crosssite_child_of('books')) {
if ((($node = menu_get_object()) && $node->type == 'book_listing') || current_path() === 'books') {
$content = '';
if (user_access('create book_listing content') && current_path() === 'books') {
$content .= '<p>' . l(t('Add book listing'), 'node/add/book-listing', array('attributes' => array('class' => 'action-button'))) . '</p>';
@@ -2702,7 +2702,7 @@ function drupalorg_preprocess_page(&$variables) {
if (isset($variables['node'])) {
if ($variables['node']->type == 'organization') {
if ($variables['node']->field_org_marketplace_request['und'][0]['value'] == 1) {
$breadcrumb[0] = l('Marketplace', 'marketplace');
$breadcrumb[0] = l('Organizations', 'drupal-services');
drupal_set_breadcrumb($breadcrumb);
} else {
$breadcrumb[0] = l('All organizations', 'organizations');
@@ -2712,10 +2712,13 @@ function drupalorg_preprocess_page(&$variables) {
}
// Reset drupalorg_crosssite_preprocess_page() overrides.
if ($reset_breadcrumb || $context || in_array($router['path'], ['group/node/%/admin/content', 'u/%/events-organized', 'u/%/events-volunteered', 'u/%/events-spoke', 'u/%/events-code-of-conduct-contact', 'user/%/documentation', 'user/%/starred', 'node/%/events-sponsored'])
|| (isset($variables['node']) && in_array($variables['node']->type, ['casestudy', 'event', 'contributor_role', 'contributor_skill', 'contributor_task', 'organization', 'project_release', 'sa', 'book_listing']))
if ($reset_breadcrumb || $context || in_array($router['path'], ['group/node/%/admin/content', 'u/%/events-organized', 'u/%/events-volunteered', 'u/%/events-spoke', 'u/%/events-code-of-conduct-contact', 'user/%/documentation', 'user/%/starred', 'node/%/events-sponsored', 'project/issues/%', 'project/issues/search/%', 'list-changes/%', 'node/%/release', 'node/%/maintainers'])
|| (isset($variables['node']) && in_array($variables['node']->type, array_merge([
'guide', 'documentation',
'page', 'section', 'post', 'event',
'casestudy', 'book_listing', 'forum',
'contributor_role', 'contributor_skill', 'contributor_task', 'organization', 'sa', 'project_release', 'project_issue', 'changenotice'], project_project_node_types())))
|| drupalorg_set_section() === 'community') {
$variables['section_name'] = '';
unset($variables['breadcrumb']);
}
@@ -2769,6 +2772,21 @@ function drupalorg_menu_breadcrumb_alter(&$active_trail, $item) {
return;
}
// Adjust project browsing breadcrumb for readability.
if (($options = project_project_set_breadcrumb(NULL, FALSE, [], FALSE)) && !empty($options['project'])) {
if ($options['project']->type === 'project_core') {
unset($active_trail[1]);
}
else {
$active_trail[1]['title'] = drupalorg_project_node_type_label($options['project']->type, 'plural');
}
}
// Remove redundant home page link.
if ($active_trail[0]['href'] === '<front>') {
array_shift($active_trail);
}
if ($context = og_context()) {
// If we are in a group.
if ($context['group_type'] === 'node') {
Loading