ExtensionBase is a base class for Editor extensions

Protected Properties

protected array $emitterSingleEventCollection

emitterSingleEventCollection of events to be fired once only

protected array $emitterEventCollection

emitterEventCollection of all registered events

protected array $emitterEventSorted

emitterEventSorted collection

Public Methods

public bindEvent()

public bindEvent($event, $callback, $priority = 0): void 

bindEvent creates a new event binding

public bindEventOnce()

public bindEventOnce($event, $callback, $priority = 0): void 

bindEventOnce creates a new event binding that fires once only

public fireEvent()

public fireEvent(
    string $event,
    array $params = [],
    boolean $halt = false
): array 

fireEvent and call the listeners

public fireSystemEvent()

public fireSystemEvent(
    string $event,
    array $params = [],
    boolean $halt = true
): mixed 

fireSystemEvent fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.

For example:

$this->fireSystemEvent('backend.list.myEvent', ['my value']);

Is equivalent to:

$this->fireEvent('list.myEvent', ['myvalue'], true);

Event::fire('backend.list.myEvent', [$this, 'myvalue'], true);

public fireViewEvent()

public fireViewEvent(string $event, array $params = []): string 

fireViewEvent is a special event function used for extending within view files, allowing HTML to be injected multiple times.

For example:

<?= $this->fireViewEvent('backend.auth.extendSigninView') ?>

public getClientSideLangStrings()

public getClientSideLangStrings(): array 

getClientSideLangStrings returns a list of language strings required for the client-side extension controller.

public getCustomData()

public getCustomData(): void

getCustomData returns custom state data required for the extension client-side controller.

public getExtensionSortOrder()

public getExtensionSortOrder(): void

getExtensionSortOrder affects the extension position in the Editor Navigator

public getNamespace()

public getNamespace(): string 

getNamespace returns unique extension namespace, for example 'cms'. Plugins extending Editor must also define a client-side state controller class in $.oc.editor.extension[namespace]. State controller classes must extend $.oc.editor.stateController.

public getNamespaceNormalized()

public getNamespaceNormalized(): void

public getNewDocumentsData()

public getNewDocumentsData(): array 

getNewDocumentsData returns a list of new document descriptions, allowing creating documents on the client side.

public getSettingsForms()

public getSettingsForms(): array 

getSettingsForms returns a list of settings form configurations for document types supported by the extension.

public listInspectorConfigurations()

public listInspectorConfigurations(): array 

listInspectorConfigurations returns a list of Inspector configurations that must be available on the client side.

public listJsFiles()

public listJsFiles(): array 

listJsFiles returns a list of JavaScript files required for the extension.

public listNavigatorSections()

public listNavigatorSections($sectionList, $documentType = null): void

listNavigatorSections initializes extension's sidebar Navigator sections. The sections must be added to the supplied section list.

public listVueComponents()

public listVueComponents(): array 

listVueComponents returns a list of Vue components required for the extension.

public runCommand()

public runCommand($command, $controller): void

runCommand handles client-side requests

public unbindEvent()

public unbindEvent($event = null): void 

unbindEvent destroys an event binding

Protected Methods

protected editorCreateDirectory()

protected editorCreateDirectory($basePath, $newName, $parent): void

protected editorDeleteFileOrDirectory()

protected editorDeleteFileOrDirectory($basePath, $fileList): void

protected editorMoveFilesOrDirectories()

protected editorMoveFilesOrDirectories(
): void

protected editorRenameFileOrDirectory()

protected editorRenameFileOrDirectory(
): void

protected editorUploadFiles()

protected editorUploadFiles($basePath, $allowedExtensions): void

protected emitterEventSortEvents()

protected emitterEventSortEvents($eventName, $combined = []): array 

emitterEventSortEvents sorts the listeners for a given event by priority

protected loadAndLocalizeJsonFile()

protected loadAndLocalizeJsonFile($path): array 

protected loadSettingsFields()

protected loadSettingsFields($fieldsClass): array