In order to show custom data in the admin of my WordPress website, I have the following action:
add_action('admin_menu', function() {
add_menu_page( 'Events',
'Events',
'manage_options',
'events',
function () {
echo view('admin.events');
},
'dashicons-tickets-alt',
6);
});
The view renders properly, but I was trying to use a Composer (class AdminEvents) to pass data to the view, but it does not seem to work. I know I can add a second array to the view() helper function to pass the data, but is there a way to use a composer with a view in this way?