src/class-wp-menu.php
private static function set( $type, $slug ) {

		global $pagenow;

		$data = self::$data[ $type ][ $slug ];

		do_action( 'wp_menu_pre_add_' . $type . '_page' );

		if ( 'menu' === $type ) {

			$page = add_menu_page(
				$data['title'],
				$data['name'],
				$data['capability'],
				$data['slug'],
				$data['function'],
				$data['icon_url'],
				$data['position']
			);

		} elseif ( 'submenu' === $type ) {

			$page = add_submenu_page(
				$data['parent'],
				$data['title'],
				$data['name'],
				$data['capability'],
				$data['slug'],
				$data['function']
			);
		}

		do_action( 'wp_menu_after_add_' . $type . '_page', 'load-' . $page );

		if ( ! $pagenow || 'admin.php' === $pagenow ) {
			self::set_action( $page, $data['styles'] );
			self::set_action( $page, $data['scripts'] );
		}
	}
private static function set( $type, $slug ) {

		global $pagenow;

		$data = self::$data[ $type ][ $slug ];

		do_action( 'wp_menu_pre_add_' . $type . '_page' );

		if ( 'menu' === $type ) {

			$page = add_menu_page(
				$data['title'],
				$data['name'],
				$data['capability'],
				$data['slug'],
				$data['function'],
				$data['icon_url'],
				$data['position']
			);

		} elseif ( 'submenu' === $type ) {

			$page = add_submenu_page(
				$data['parent'],
				$data['title'],
				$data['name'],
				$data['capability'],
				$data['slug'],
				$data['function']
			);
		}

		do_action( 'wp_menu_after_add_' . $type . '_page', 'load-' . $page );

		if ( ! $pagenow || 'admin.php' === $pagenow ) {
			self::set_action( $page, $data['styles'] );
			self::set_action( $page, $data['scripts'] );
		}
	}
private static function set ( $ type , $ slug ) { global $ pagenow ; $ data = self :: $ data [ $ type ] [ $ slug ] ; do_action ( 'wp_menu_pre_add_' . $ type . '_page' ) ; if ( 'menu' === $ type ) { $ page = add_menu_page ( $ data [ 'title' ] , $ data [ 'name' ] , $ data [ 'capability' ] , $ data [ 'slug' ] , $ data [ 'function' ] , $ data [ 'icon_url' ] , $ data [ 'position' ] ) ; } elseif ( 'submenu' === $ type ) { $ page = add_submenu_page ( $ data [ 'parent' ] , $ data [ 'title' ] , $ data [ 'name' ] , $ data [ 'capability' ] , $ data [ 'slug' ] , $ data [ 'function' ] ) ; } do_action ( 'wp_menu_after_add_' . $ type . '_page' , 'load-' . $ page ) ; if ( ! $ pagenow || 'admin.php' === $ pagenow ) { self :: set_action ( $ page , $ data [ 'styles' ] ) ; self :: set_action ( $ page , $ data [ 'scripts' ] ) ; } }
Set menu and submenu admin.

@since 1.0.1

@param string $type → menu|submenu.
@param string $slug → menu|submenu slug.
Set menu and submenu admin .