acf_admin_options_page::admin_menu
description
Метод класса: acf_admin_options_page{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$acf_admin_options_page = new acf_admin_options_page(); $acf_admin_options_page->admin_menu();
Список изменений
| С версии 5.0.0 | Введена. |
Код acf_admin_options_page::admin_menu() acf admin options page::admin menu ACF 6.4.2
public function admin_menu() {
// vars
$pages = acf_get_options_pages();
// bail early if no pages
if ( empty( $pages ) ) {
return;
}
// loop
foreach ( $pages as $page ) {
// vars
$slug = '';
// parent
if ( empty( $page['parent_slug'] ) ) {
$slug = add_menu_page( $page['page_title'], $page['menu_title'], $page['capability'], $page['menu_slug'], array( $this, 'html' ), $page['icon_url'], $page['position'] );
// child
} else {
$slug = add_submenu_page( $page['parent_slug'], $page['page_title'], $page['menu_title'], $page['capability'], $page['menu_slug'], array( $this, 'html' ), $page['position'] );
}
// actions
add_action( "load-{$slug}", array( $this, 'admin_load' ) );
}
}