Changeset 12288
- Timestamp:
- 11/15/2018 08:14:01 PM (6 years ago)
- Location:
- trunk/src/bp-core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-buddybar.php
r12195 r12288 18 18 * @since 1.1.0 19 19 * @since 2.6.0 Introduced the `$component` parameter. 20 * @since 4.0.0 Introduced the `$component_id` argument. 20 21 * 21 22 * @param array|string $args { … … 23 24 * @type string $name Display name for the nav item. 24 25 * @type string $slug Unique URL slug for the nav item. 26 * @type string $component_id Optional. The ID of the component registering the nav item. Defaults to slug. 25 27 * @type bool|string $item_css_id Optional. 'id' attribute for the nav item. Default: the value of `$slug`. 26 28 * @type bool $show_for_displayed_user Optional. Whether the nav item should be visible when viewing a … … 45 47 'name' => false, // Display name for the nav item. 46 48 'slug' => false, // URL slug for the nav item. 49 'component_id' => '', // ID of the component registering the nav item. 47 50 'item_css_id' => false, // The CSS ID to apply to the HTML of the nav item. 48 51 'show_for_displayed_user' => true, // When viewing another user does this nav item show up? … … 91 94 * 92 95 * @since 2.4.0 93 * @since 2.6.0 Introduced the `$component` parameter. Began returning a BP_Core_Nav_Item object on success. 96 * @since 2.6.0 Introduced the `$component` parameter. Began returning a BP_Core_Nav_Item 97 * object on success. 98 * @since 4.0.0 Introduced `$component_id` argument. 94 99 * 95 100 * @param array|string $args { 96 101 * Array describing the new nav item. 102 * @type string $component_id Optional. The ID of the component registering this nav item. Defaults to the 103 * the value of `$slug`. 97 104 * @type string $name Display name for the nav item. 98 105 * @type string $slug Unique URL slug for the nav item. … … 115 122 116 123 $defaults = array( 124 'component_id' => '', // The component ID registering this nav item. 117 125 'name' => false, // Display name for the nav item. 118 126 'slug' => false, // URL slug for the nav item. … … 137 145 } 138 146 147 if ( empty( $r['component_id'] ) ) { 148 $r['component_id'] = $r['slug']; 149 } 150 139 151 if ( empty( $r['item_css_id'] ) ) { 140 152 $r['item_css_id'] = $r['slug']; … … 142 154 143 155 $nav_item = array( 156 'component_id' => $r['component_id'], 144 157 'name' => $r['name'], 145 158 'slug' => $r['slug'], … … 343 356 if ( empty( $unfiltered_action ) ) { 344 357 if ( ! bp_is_current_action( $r['subnav_slug'] ) ) { 358 /* 359 * If the screen function isn't available, attempt to find it. 360 * 361 * This is due to our conditional-loading code since v3.0.0. 362 */ 363 if ( ! is_callable( $r['screen_function'] ) && ! empty( $parent_nav->component_id ) ) { 364 $file = $bp->core->path . 'bp-' . $parent_nav->component_id . '/screens/' . $r['subnav_slug'] . '.php'; 365 $file_path = realpath( $file ); 366 367 // Found the file, so require it. 368 if ( $file === $file_path && file_exists( $file ) ) { 369 require_once $file; 370 } 371 } 372 345 373 if ( is_callable( $r['screen_function'] ) ) { 346 374 add_action( 'bp_screens', $r['screen_function'], 3 ); -
trunk/src/bp-core/classes/class-bp-component.php
r12180 r12288 499 499 // No sub nav items without a main nav item. 500 500 if ( !empty( $main_nav ) ) { 501 // Always set the component ID. 502 $main_nav['component_id'] = $this->id; 503 501 504 bp_core_new_nav_item( $main_nav, 'members' ); 502 505
Note: See TracChangeset
for help on using the changeset viewer.