Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/08/2016 05:56:22 AM (9 years ago)
Author:
r-a-y
Message:

BP Component: Allow plugins to set a custom position when registering an admin bar subnav menu.

This commit allows plugins to set a 'position' key when registering a WP
Admin Bar subnav menu item in the setup_admin_bar() method.

Previously, plugins had to do all sorts of array shuffling in order to
register their subnav at a preferred position. For backward compatibility,
we do some 'position' key backfilling, so if a plugin isn't using the new
'position' key, their subnav should still display at the same location.

Fixes #6859.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-notifications/classes/class-bp-notifications-component.php

    r10523 r10555  
    203203            // Unread.
    204204            $wp_admin_nav[] = array(
    205                 'parent' => 'my-account-' . $this->id,
    206                 'id'     => 'my-account-' . $this->id . '-unread',
    207                 'title'  => $unread,
    208                 'href'   => $notifications_link
     205                'parent'   => 'my-account-' . $this->id,
     206                'id'       => 'my-account-' . $this->id . '-unread',
     207                'title'    => $unread,
     208                'href'     => $notifications_link,
     209                'position' => 10
    209210            );
    210211
    211212            // Read.
    212213            $wp_admin_nav[] = array(
    213                 'parent' => 'my-account-' . $this->id,
    214                 'id'     => 'my-account-' . $this->id . '-read',
    215                 'title'  => _x( 'Read', 'My Account Notification sub nav', 'buddypress' ),
    216                 'href'   => trailingslashit( $notifications_link . 'read' ),
     214                'parent'   => 'my-account-' . $this->id,
     215                'id'       => 'my-account-' . $this->id . '-read',
     216                'title'    => _x( 'Read', 'My Account Notification sub nav', 'buddypress' ),
     217                'href'     => trailingslashit( $notifications_link . 'read' ),
     218                'position' => 20
    217219            );
    218220        }
Note: See TracChangeset for help on using the changeset viewer.