mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 09:13:19 -04:00
fix: Emit new BeforeGetTemplates event
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
This commit is contained in:
parent
e65f318fdf
commit
05ed5aa230
7 changed files with 31 additions and 6 deletions
|
|
@ -435,6 +435,7 @@ return array(
|
|||
'OCP\\Files\\Storage\\IStorage' => $baseDir . '/lib/public/Files/Storage/IStorage.php',
|
||||
'OCP\\Files\\Storage\\IStorageFactory' => $baseDir . '/lib/public/Files/Storage/IStorageFactory.php',
|
||||
'OCP\\Files\\Storage\\IWriteStreamStorage' => $baseDir . '/lib/public/Files/Storage/IWriteStreamStorage.php',
|
||||
'OCP\\Files\\Template\\BeforeGetTemplatesEvent' => $baseDir . '/lib/public/Files/Template/BeforeGetTemplatesEvent.php',
|
||||
'OCP\\Files\\Template\\Field' => $baseDir . '/lib/public/Files/Template/Field.php',
|
||||
'OCP\\Files\\Template\\FieldType' => $baseDir . '/lib/public/Files/Template/FieldType.php',
|
||||
'OCP\\Files\\Template\\FileCreatedFromTemplateEvent' => $baseDir . '/lib/public/Files/Template/FileCreatedFromTemplateEvent.php',
|
||||
|
|
|
|||
|
|
@ -468,6 +468,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
|
|||
'OCP\\Files\\Storage\\IStorage' => __DIR__ . '/../../..' . '/lib/public/Files/Storage/IStorage.php',
|
||||
'OCP\\Files\\Storage\\IStorageFactory' => __DIR__ . '/../../..' . '/lib/public/Files/Storage/IStorageFactory.php',
|
||||
'OCP\\Files\\Storage\\IWriteStreamStorage' => __DIR__ . '/../../..' . '/lib/public/Files/Storage/IWriteStreamStorage.php',
|
||||
'OCP\\Files\\Template\\BeforeGetTemplatesEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Template/BeforeGetTemplatesEvent.php',
|
||||
'OCP\\Files\\Template\\Field' => __DIR__ . '/../../..' . '/lib/public/Files/Template/Field.php',
|
||||
'OCP\\Files\\Template\\FieldType' => __DIR__ . '/../../..' . '/lib/public/Files/Template/FieldType.php',
|
||||
'OCP\\Files\\Template\\FileCreatedFromTemplateEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Template/FileCreatedFromTemplateEvent.php',
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use OCP\Files\GenericFileException;
|
|||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\Node;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\Template\BeforeGetTemplatesEvent;
|
||||
use OCP\Files\Template\FileCreatedFromTemplateEvent;
|
||||
use OCP\Files\Template\ICustomTemplateProvider;
|
||||
use OCP\Files\Template\ITemplateManager;
|
||||
|
|
@ -204,6 +205,8 @@ class TemplateManager implements ITemplateManager {
|
|||
}
|
||||
}
|
||||
|
||||
$this->eventDispatcher->dispatchTyped(new BeforeGetTemplatesEvent($templates));
|
||||
|
||||
return $templates;
|
||||
}
|
||||
|
||||
|
|
|
|||
24
lib/public/Files/Template/BeforeGetTemplatesEvent.php
Normal file
24
lib/public/Files/Template/BeforeGetTemplatesEvent.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCP\Files\Template;
|
||||
|
||||
use OCP\EventDispatcher\Event;
|
||||
|
||||
class BeforeGetTemplatesEvent extends Event {
|
||||
private array $templates;
|
||||
|
||||
public function __construct(array $templates) {
|
||||
parent::__construct();
|
||||
|
||||
$this->templates = $templates;
|
||||
}
|
||||
|
||||
public function getTemplates(): array {
|
||||
return $this->templates;
|
||||
}
|
||||
}
|
||||
|
|
@ -7,12 +7,10 @@
|
|||
|
||||
namespace OCP\Files\Template;
|
||||
|
||||
use OCP\Files\Template\FieldType;
|
||||
|
||||
class Field {
|
||||
public FieldType $type;
|
||||
|
||||
public function __construct(FieldType $type) {
|
||||
$this->type = $type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@ namespace OCP\Files\Template;
|
|||
|
||||
enum FieldType {
|
||||
case PlainText;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ declare(strict_types=1);
|
|||
namespace OCP\Files\Template;
|
||||
|
||||
use OCP\Files\File;
|
||||
use OCP\Files\Template\Field;
|
||||
use OCP\Files\Template\FieldType;
|
||||
|
||||
/**
|
||||
* @since 21.0.0
|
||||
|
|
|
|||
Loading…
Reference in a new issue