BP_Core_BP_Options_Nav_BackCompat::offsetGet( mixed $offset )

Get a value of the nav array at the specified offset.


Description Description


Parameters Parameters

$offset

(Required) Array offset.


Top ↑

Return Return

(BP_Core_BP_Nav_BackCompat)


Top ↑

Source Source

File: bp-core/classes/class-bp-core-bp-options-nav-backcompat.php

	public function offsetGet( $offset ) {
		_doing_it_wrong(
			'bp_nav',
			__( 'These globals should not be used directly and are deprecated. Please use the BuddyPress nav functions instead.', 'buddypress' ),
			'2.6.0'
		);

		if ( empty( $this->backcompat_nav[ $offset ] ) ) {
			$nav = $this->get_nav( $offset );
			if ( $nav ) {
				$subnavs = $this->get_component_nav( $offset )->get_secondary( array( 'parent_slug' => $offset ) );
				$subnav_keyed = array();
				if ( $subnavs ) {
					foreach ( $subnavs as $subnav ) {
						$subnav_keyed[ $subnav->slug ] = (array) $subnav;
					}
				}

				$subnav_object = new self( $subnav_keyed );
				$subnav_object->set_component( $this->get_component() );
				$subnav_object->set_parent_slug( $offset );

				$this->backcompat_nav[ $offset ] = $subnav_object;
			}
		}

		if ( isset( $this->backcompat_nav[ $offset ] ) ) {
			return $this->backcompat_nav[ $offset ];
		}

		return false;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.