[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/classes/ -> class-bp-core-bp-nav-backcompat.php (summary)

Backward compatibility for the $bp->bp_nav global.

File Size: 270 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

BP_Core_BP_Nav_BackCompat:: (11 methods):
  __construct()
  offsetSet()
  offsetGet()
  offsetExists()
  offsetUnset()
  set_component()
  get_component()
  reset()
  get_nav()
  get_component_nav()
  to_array()


Class: BP_Core_BP_Nav_BackCompat  - X-Ref

bp_nav backward compatibility class.

This class is used to provide backward compatibility for extensions that access and modify
the $bp->bp_nav global.

__construct( $backcompat_nav = array()   X-Ref
Constructor.

param: array $backcompat_nav Optional. Array of nav items.
since: 2.6.0

offsetSet( $offset, $value )   X-Ref
Assign a value to the nav array at the specified offset.

param: mixed $offset Array offset.
param: array $value  Nav item.
since: 2.6.0

offsetGet( $offset )   X-Ref
Get a value of the nav array at the specified offset.

param: mixed $offset Array offset.
since: 2.6.0
return: BP_Core_BP_Nav_BackCompat

offsetExists( $offset )   X-Ref
Check whether nav array has a value at the specified offset.

param: mixed $offset Array offset.
since: 2.6.0
return: bool

offsetUnset( $offset )   X-Ref
Unset a nav array value at the specified offset.

param: mixed $offset Array offset.
since: 2.6.0

set_component( $component )   X-Ref
Set the component to which the nav belongs.

param: string $component
since: 2.6.0

get_component( $offset = '' )   X-Ref
Get the component to which the a nav item belongs.

We use the following heuristic to guess, based on an offset, which component the item belongs to:
- If this is a group, and the offset is the same as the current group's slug, it's a group nav item.
- Otherwise, it's a member nav item.

param: mixed $offset Array offset.
since: 2.6.0
return: string|array

reset()   X-Ref
Reset the cached nav items.

Called when the nav API removes items from the nav array.

since: 2.6.0

get_nav( $offset )   X-Ref
Get the nav object corresponding to the specified offset.

param: mixed $offset Array offset.
since: 2.6.0
return: bool|array

get_component_nav( $offset = '' )   X-Ref
Get the BP_Core_Nav object corresponding to the component, based on a nav item name.

The way bp_nav was previously organized makes it impossible to know for sure which component's nav is
being referenced by a given nav item name. We guess in the following manner:
- If we're looking at a group, and the nav item name (`$offset`) is the same as the slug of the current
group, we assume that the proper component nav is 'groups'.
- Otherwise, fall back on 'members'.

param: string $offset Nav item name.
since: 2.6.0
return: BP_Core_Nav

to_array()   X-Ref
Get the nav data, formatted as a flat array.

since: 2.6.0
return: array



Generated: Sun Dec 22 01:00:54 2024 Cross-referenced by PHPXref 0.7.1