Skip to content

Commit

Permalink
fixup! Add new LoadAdditionalScriptsEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
rullzer committed Aug 7, 2019
1 parent eedc25c commit fb4dd15
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions apps/files/lib/Listener/LegacyLoadAdditionalScriptsAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,25 @@

use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\EventDispatcher\IEventListener;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;

class LegacyLoadAdditionalScriptsAdapter implements IEventListener {

/** @var EventDispatcherInterface */
private $legacyDispatcher;
/** @var IEventDispatcher */
private $dispatcher;

public function __construct(EventDispatcherInterface $legacyDispatcher) {
$this->legacyDispatcher = $legacyDispatcher;
public function __construct(IEventDispatcher $legacyDispatcher) {
$this->dispatcher = $legacyDispatcher;
}

public function handle(Event $event): void {
if (!($event instanceof LoadAdditionalScriptsEvent)) {
return;
}

$legacyEvent = new GenericEvent(null, ['hiddenFields' => []]);
$this->legacyDispatcher->dispatch('OCA\Files::loadAdditionalScripts', $legacyEvent);
$legacyEvent = new Event(null, ['hiddenFields' => []]);
$this->dispatcher->dispatch('OCA\Files::loadAdditionalScripts', $legacyEvent);

$hiddenFields = $legacyEvent->getArgument('hiddenFields');
foreach ($hiddenFields as $name => $value) {
Expand Down

0 comments on commit fb4dd15

Please sign in to comment.