<?php

if (!empty($p) && $p instanceOf Page) {
    $twig->addGlobal('menu_options', [
        'active_page_id'        => $p->id,          // identidied the list item that needs class 'active'
        'active_page_trail'     => $p->get_trail(), // this option sets a 'childActive' call on all parent page & active page list items
    ]);
}
