mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-08 08:14:25 +02:00
Create event for directory_item hook
This commit is contained in:
parent
20a1d22620
commit
88929bb307
5 changed files with 20 additions and 3 deletions
|
@ -15,6 +15,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\DI;
|
||||
use Friendica\Event\ArrayFilterEvent;
|
||||
use Friendica\Model;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
@ -161,13 +162,22 @@ class Directory extends BaseModule
|
|||
|
||||
];
|
||||
|
||||
$hook = ['contact' => $contact, 'entry' => $entry];
|
||||
$eventDispatcher = DI::eventDispatcher();
|
||||
|
||||
Hook::callAll('directory_item', $hook);
|
||||
$hook_data = [
|
||||
'contact' => $contact,
|
||||
'entry' => $entry,
|
||||
];
|
||||
|
||||
$hook_data = $eventDispatcher->dispatch(
|
||||
new ArrayFilterEvent(ArrayFilterEvent::DIRECTORY_ITEM, $hook_data),
|
||||
)->getArray();
|
||||
|
||||
$entry = $hook_data['entry'] ?? $entry;
|
||||
|
||||
unset($profile);
|
||||
unset($location);
|
||||
|
||||
return $hook['entry'];
|
||||
return $entry;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue