Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

orchidsoftware/platform

4733 stars
1 code files
View orchidsoftware/platform on GitHub

src/Screen/Actions/Menu.php

Open in GitHub
class Menu extends Link
{
//
public function __construct()
{
$this
->addBeforeRender(function () {
$href = $this->get('href');
 
if ($href !== null) {
return;
}
 
$slug = $this->getSlug();
 
$this
->set('data-bs-toggle', 'collapse')
->set('href', '#menu-' . $slug);
})
->addBeforeRender(function () {
if ($this->get('active') !== null) {
return;
}
 
$active = collect([])
->merge($this->get('list'))
->map(function (Menu $menu) {
return $menu->get('href');
})
->push($this->get('href'))
->filter()
->map(function ($href) {
return [
$href,
$href . '?*',
$href . '/*',
];
})
->flatten();
 
$this->set('active', $active->toArray());
});
}
//
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.