Skip to content
Snippets Groups Projects
Commit a273aff9 authored by Neil Drumm's avatar Neil Drumm :wave:
Browse files

Issue #3314554: Remove section navigation from user pages & use new style

parent 5501ab36
No related branches found
No related tags found
1 merge request!17Use new styles on user pages, and remove section navigation from them
......@@ -21,8 +21,6 @@ function drupalorg_crosssite_ctools_plugin_directory($owner, $plugin_type) {
* Add header, footer and content menu data to the page variables.
*/
function drupalorg_crosssite_preprocess_page(&$vars, $hook) {
global $user;
// Killswitch for standard Drupal.org navigation. Used on DrupalCon sites.
// Would be good to remove.
if (!variable_get('drupalorg_navigation', TRUE)) {
......@@ -77,41 +75,6 @@ function drupalorg_crosssite_preprocess_page(&$vars, $hook) {
);
break;
case 'user':
if (is_numeric(arg(1)) && ($account = user_load(arg(1)))) {
$wrapper = entity_metadata_wrapper('user', $account);
if ($main_site) {
$first_name = $wrapper->field_first_name->value();
$last_name = $wrapper->field_last_name->value();
}
if (!empty($first_name) && !empty($last_name) && $first_name . ' ' . $last_name === $account->name) {
$vars['section_name'] = check_plain($account->name);
}
elseif (!empty($first_name) || !empty($last_name)) {
$vars['section_name'] = t('@first_name @last_name (@user_name)', array('@first_name' => $first_name, '@last_name' => $last_name, '@user_name' => $account->name));
}
else {
$vars['section_name'] = check_plain($account->name);
}
$nav_content_links = array(
'user-profile' => array(
'title' => t('Profile'),
'href' => 'user/' . $account->uid,
'#active' => drupalorg_crosssite_match_path('^user/' . $account->uid . '(?!/track|/starred)'),
),
'posts' => array(
'title' => t('Posts'),
'href' => 'user/' . $account->uid . '/track',
),
'starred' => [
'title' => t('Starred'),
'href' => 'user/' . $account->uid . '/starred',
],
);
}
break;
case 'drupalorgprojects':
$vars['section_name'] = 'Community projects';
$nav_content_links = array(
......@@ -338,8 +301,8 @@ function drupalorg_crosssite_preprocess_html(&$vars, $hook) {
if ($new_style
|| in_array(variable_get('drupalorg_site', 'main'), ['localize'])
|| ((($node = menu_get_object()) || ($item && $item['path'] === 'comment/reply/%' && ($node = menu_get_object('node', 2)))) && (in_array($node->type, $content_types) || (!empty($node->book['bid']) && $node->book['bid'] == 281873)))
|| (in_array(current_path(), ['welcome', 'user/login', 'user/password', 'user/register', 'git_error']))
|| (user_is_anonymous() && current_path() === 'user')
|| (in_array(current_path(), ['welcome', 'git_error']))
|| (strpos(current_path(), 'user') === 0)
|| ($item && (($item['page_callback'] === 'views_page' && in_array($item['page_arguments'][0], ['hosting', 'book_listings', 'drupalorg_casestudies', 'event', 'drupalorg_community_spotlight', 'drupalorg_security_announcements', 'drupalorg_security_announcements_contrib', 'drupalorg_security_announcements_psa', 'drupalorg_organizations', 'drupal_org_all_organizations', 'drupalorg_supporting_technologies', 'drupalorg_training', 'doc_guide_per_user', 'issue_credit', 'community_events']))
|| ($item['page_callback'] === 'node_add' && in_array($item['page_arguments'][0], $content_types))
|| in_array($item['page_callback'], ['forum_page'])
......@@ -388,7 +351,6 @@ function drupalorg_crosssite_preprocess_html(&$vars, $hook) {
* Specify the section matching criteria.
*/
function drupalorg_crosssite_section() {
global $user;
static $section = FALSE;
if ($section === FALSE) {
......@@ -415,13 +377,6 @@ function drupalorg_crosssite_section() {
elseif ((drupalorg_crosssite_match_path('^(project(?!/(issues/)?user)|list-changes|list-change-updates|pift-ci-job)(/|$)') || drupalorg_crosssite_match_path('^node/\d+/(release|committers|maintainers)') || drupalorg_crosssite_match_path('^node/add/project-issue') || drupalorg_crosssite_is_type(array_merge(project_project_node_types(), project_issue_issue_node_types(), project_release_release_node_types(), ['changenotice']))) && (!isset($node) || $node->type !== 'project_release')) {
$section = 'downloads';
}
elseif (drupalorg_crosssite_match_path('^u(ser)?(/|$)')) {
// Do not include crosssite navigation for TFA setup pages, and other
// listings.
if (!((arg(3) === 'tfa' && arg(4)) || arg(2) === 'documentation')) {
$section = 'user';
}
}
break;
}
......@@ -529,9 +484,6 @@ function drupalorg_crosssite_menu_absolute_links($links) {
* Arrange local tasks for user pages.
*/
function drupalorg_crosssite_menu_alter(&$items) {
if (isset($items['user/%user/track'])) {
$items['user/%user/track']['type'] = MENU_CALLBACK;
}
// Modify the local tasks for search to hide the tabs.
if (module_exists('search')) {
foreach ($items as $path => $item) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment