get_menu_icon(), 10 ); $menu_items = apply_filters( 'aisentic_menu', $menu_items ); $position = array_column( $menu_items, 'position' ); array_multisort( $position, SORT_ASC, $menu_items ); foreach ( $menu_items as $item ) { $external = ! empty( $item['external_link'] ) ? $item['external_link'] : false; $link = ! $external ? $url . $item['link'] : $item['link']; $submenu[ $slug ][] = [ $item['title'], $item['capability'], $link ]; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited } } /** * Get the admin menu icon as a base64 data URI. * * Falls back to a dashicon if the SVG file is missing. * * @return string */ public function get_menu_icon() { $icon_path = AISENTIC_DIR . '/assets/images/admin/aisentic.svg'; if ( ! file_exists( $icon_path ) ) { return 'dashicons-superhero-alt'; } $svg = file_get_contents( $icon_path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents if ( false === $svg ) { return 'dashicons-superhero-alt'; } return 'data:image/svg+xml;base64,' . base64_encode( $svg ); } /** * Render main menu page * * @return void */ public function aisentic_dashboard_view() { ?>