mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-11 08:14:27 +02:00
Add ArrayFilterEvent, replace app_menu hook
This commit is contained in:
parent
5b28b3d28f
commit
715248d6a2
5 changed files with 158 additions and 8 deletions
|
@ -15,6 +15,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Event\ArrayFilterEvent;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Conversation\Community;
|
||||
|
@ -22,6 +23,7 @@ use Friendica\Module\Home;
|
|||
use Friendica\Module\Security\Login;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Security\OpenWebAuth;
|
||||
use Psr\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
class Nav
|
||||
{
|
||||
|
@ -63,14 +65,17 @@ class Nav
|
|||
/** @var Router */
|
||||
private $router;
|
||||
|
||||
public function __construct(BaseURL $baseUrl, L10n $l10n, IHandleUserSessions $session, Database $database, IManageConfigValues $config, Router $router)
|
||||
private EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
public function __construct(BaseURL $baseUrl, L10n $l10n, IHandleUserSessions $session, Database $database, IManageConfigValues $config, Router $router, EventDispatcherInterface $eventDispatcher)
|
||||
{
|
||||
$this->baseUrl = $baseUrl;
|
||||
$this->l10n = $l10n;
|
||||
$this->session = $session;
|
||||
$this->database = $database;
|
||||
$this->config = $config;
|
||||
$this->router = $router;
|
||||
$this->baseUrl = $baseUrl;
|
||||
$this->l10n = $l10n;
|
||||
$this->session = $session;
|
||||
$this->database = $database;
|
||||
$this->config = $config;
|
||||
$this->router = $router;
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,7 +156,7 @@ class Nav
|
|||
) {
|
||||
$arr = ['app_menu' => $appMenu];
|
||||
|
||||
Hook::callAll('app_menu', $arr);
|
||||
$arr = $this->eventDispatcher->dispatch(new ArrayFilterEvent(ArrayFilterEvent::APP_MENU, $arr))->getArray();
|
||||
|
||||
$appMenu = $arr['app_menu'];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue