Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_View_Manager::get_menu_items_to_add()

Retrieve an array of nodes to be added to the admin bar


Return Return

(array[]) An array of arrays formatted to be passed to WP_Admin_Bar::add_node().


Top ↑

Source Source

File: includes/class.llms.view.manager.php

	private function get_menu_items_to_add() {

		$nodes  = array();
		$view   = $this->get_view();
		$views  = $this->get_views();
		$top_id = 'llms-view-as-menu';

		// Translators: %s = View manager role name.
		$title = sprintf( __( 'Viewing as %s', 'lifterlms' ), $views[ $view ] );

		// Add the top-level node.
		$nodes[] = array(
			'id'     => $top_id,
			'parent' => 'top-secondary',
			'title'  => '<span class="ab-icon"><img src="' . llms()->plugin_url() . '/assets/images/lifterlms-icon.png" style="height:17px;margin-top:3px;opacity:0.65;"></span>' . $title,
		);

		// Add view as links.
		foreach ( $views as $role => $name ) {

			// Exclude the current view.
			if ( $role === $view ) {
				continue;
			}

			$nodes[] = array(
				'href'   => self::get_url( $role ),
				'id'     => 'llms-view-as--' . $role,
				'parent' => $top_id,
				// Translators: %s = View manager role name.
				'title'  => sprintf( __( 'View as %s', 'lifterlms' ), $name ),
			);

		}

		return $nodes;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
4.16.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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