Media\Widgets\MediaManager

Overview

MediaManager widget

Extends

Public Properties

public bool $readOnly

readOnly determines whether the widget is in readonly mode or not.

public bool $bottomToolbar

bottomToolbar determines whether the bottom toolbar is visible.

public bool $cropAndInsertButton

cropAndInsertButton determines whether the Crop & Insert button is visible.

Show inherited public properties

Inherited Public Properties

Protected Properties

protected string $currentFolder

protected string $brokenImageHash

brokenImageHash string for the broken image graphic.

protected string $defaultAlias

defaultAlias to identify this widget.

Show inherited protected properties

Inherited Protected Properties


Public Methods

public __construct()

public __construct($controller, $config = [], $readOnly = false): void

public onApplyName()

public onApplyName(): array 

onApplyName renames an item

public onChangeView()

public onChangeView(): array 

onChangeView preference

public onCreateFolder()

public onCreateFolder(): array 

onCreateFolder shows the create folder popup

public onCropImage()

public onCropImage(): array 

onCropImage AJAX handler

public onDeleteItem()

public onDeleteItem(): array 

onDeleteItem deletes a library item

public onEndCroppingSession()

public onEndCroppingSession(): array 

onEndCroppingSession AJAX handler

public onGenerateThumbnails()

public onGenerateThumbnails(): array 

public onGetSidebarThumbnail()

public onGetSidebarThumbnail(): array 

public onGoToFolder()

public onGoToFolder(): array 

public onLoadImageCropPopup()

public onLoadImageCropPopup(): array 

onLoadImageCropPopup for cropping AJAX handler

public onLoadMovePopup()

public onLoadMovePopup(): array 

onLoadMovePopup shows the move item popup

public onLoadPopup()

public onLoadPopup(): array 

onLoadPopup starts the image cropping session AJAX handler

public onLoadRenamePopup()

public onLoadRenamePopup(): array 

onLoadRenamePopup shows the rename item popup

public onMoveItems()

public onMoveItems(): array 

onMoveItems AJAX handler

public onResizeImage()

public onResizeImage(): array 

onResizeImage AJAX handler

public onSearch()

public onSearch(): array 

onSearch perform a search

public onSetFilter()

public onSetFilter(): array 

onSetFilter preference

public onSetSidebarVisible()

public onSetSidebarVisible(): array 

onSetSidebarVisible AJAX handler

public onSetSorting()

public onSetSorting(): array 

onSetSorting ets sorting preference

public render()

public render(): string 

render the widget.

Show inherited public methods

Inherited Public Methods

Protected Methods

protected checkHasPermission()

protected checkHasPermission($name): void

checkHasPermission checks if a custom permission has been specified

protected checkUploadPostback()

protected checkUploadPostback(): void

checkUploadPostback detects the upload post flag.

protected copyBrokenImage()

protected copyBrokenImage(string $path): void 

copyBrokenImage to destination

protected cropImage()

protected cropImage(
    string $imageSrcPath,
    array $selectionData,
    string $cropSessionKey,
    string $path
): array 

cropImage is business logic to crop a media library image

protected findFiles()

protected findFiles(
    string $searchTerm,
    string $filter,
    string $sortBy
): void

findFiles from within the media library based on supplied criteria, returns an array of MediaLibraryItem objects.

protected generateThumbnail()

protected generateThumbnail(
    array $thumbnailInfo,
    array|null $thumbnailParams = null
): array 

protected getBrokenImageHash()

protected getBrokenImageHash(): string 

getBrokenImageHash returns a CRC32 hash for a broken image

protected getBrokenImagePath()

protected getBrokenImagePath(): string 

getBrokenImagePath returns the path for the broken image graphic

protected getCropEditImageUrlAndSize()

protected getCropEditImageUrlAndSize(
    string $path,
    string $cropSessionKey,
    array $params = null
): array 

getCropEditImageUrlAndSize prepares an image for cropping and returns payload containing a URL

protected getCropSessionDirPath()

protected getCropSessionDirPath(string $cropSessionKey): string 

getCropSessionDirPath returns the crop session working directory path

protected getCurrentFolder()

protected getCurrentFolder(): string 

getCurrentFolder gets the user current folder from the session state

protected getFilter()

protected getFilter(): string 

getFilter gets the user filter from the session state

protected getLocalTempFilePath()

protected getLocalTempFilePath(string $fileName): string 

protected getPlaceholderId()

protected getPlaceholderId(Media\Classes\MediaLibraryItem $item): string 

protected getSearchTerm()

protected getSearchTerm(): string 

getSearchTerm gets the user search term from the session state

protected getSelectionParams()

protected getSelectionParams(): array 

getSelectionParams gets the user selection parameters from the session state

protected getSidebarVisible()

protected getSidebarVisible(): bool 

getSidebarVisible checks if the sidebar is visible

protected getSortBy()

protected getSortBy(): string 

getSortBy gets the user sort column from the session state

protected getSortDirection()

protected getSortDirection(): string 

getSortDirection gets the user sort direction from the session state

protected getTargetDimensions()

protected getTargetDimensions(
    int $width,
    int $height,
    string $originalImagePath
): void 

protected getThumbnailDirectory()

protected getThumbnailDirectory(): string 

protected getThumbnailImageExtension()

protected getThumbnailImageExtension(string $itemPath): string 

protected getThumbnailImagePath()

protected getThumbnailImagePath(
    array|null $thumbnailParams,
    string $itemPath,
    int $lastModified
): string 

getThumbnailImagePath generatess a thumbnail image path

protected getThumbnailImageUrl()

protected getThumbnailImageUrl(string $imagePath): string 

getThumbnailImageUrl returns the URL to a thumbnail

protected getThumbnailParams()

protected getThumbnailParams(string $viewMode = null): array 

getThumbnailParams returns thumbnail parameters

protected getViewMode()

protected getViewMode(): string 

getViewMode returns the current view mode stored in the session

protected isVector()

protected isVector(string $path): bool 

isVector detects if image is vector graphic (SVG)

protected itemTypeToIconClass()

protected itemTypeToIconClass(
    Media\Classes\MediaLibraryItem $item,
    string $itemType
): string 

itemTypeToIconClass returns an icon for the item type

protected listFolderItems()

protected listFolderItems(
    string $searchTerm,
    string $filter,
    string $sortBy
): void

listFolderItems returns a list of folders and files in a Library folder.

protected loadAssets()

protected loadAssets(): void 

loadAssets adds widget specific asset files. Use $this->addJs() and $this->addCss() to register new assets to include on the page.

protected prepareVars()

protected prepareVars(): void

prepareVars is an internal method to prepare view variables.

protected removeCropEditDir()

protected removeCropEditDir(string $cropSessionKey): void 

removeCropEditDir cleans up the directory used for cropping based on the session key

protected resizeImage()

protected resizeImage(
    string $fullThumbnailPath,
    array $thumbnailParams,
    string $tempFilePath
): void 

protected setCurrentFolder()

protected setCurrentFolder(string $path): void 

setCurrentFolder sets the user current folder from the session state

protected setFilter()

protected setFilter(string $filter): void 

setFilter sets the user filter from the session state

protected setSearchTerm()

protected setSearchTerm(string $searchTerm): void 

setSearchTerm sets the user search term from the session state

protected setSelectionParams()

protected setSelectionParams(
    string $selectionMode,
    int $selectionWidth,
    int $selectionHeight
): void 

setSelectionParams stores the user selection parameters in the session state

protected setSidebarVisible()

protected setSidebarVisible(bool $visible): void 

setSidebarVisible state

protected setSortBy()

protected setSortBy(string $sortBy): void 

setSortBy sets the user sort column from the session state

protected setSortDirection()

protected setSortDirection(string $sortDirection): void 

setSortDirection sets the user sort direction from the session state

protected setViewMode()

protected setViewMode(string $viewMode): void 

setViewMode stores a view mode in the session

protected slugFileName()

protected slugFileName(string $name): string 

slugFileName creates a slug form the string. A modified version of Str::slug with the main difference that it accepts @-signs

protected splitPathToSegments()

protected splitPathToSegments(string $path): array 

protected thumbnailExists()

protected thumbnailExists(
    array|null $thumbnailParams,
    string $itemPath,
    int $lastModified
): bool 

thumbnailExists checks if a thumbnail exists

protected thumbnailIsError()

protected thumbnailIsError(string $thumbnailPath): bool 

thumbnailIsError checks if a thumbnail has caused an error

protected validateFileName()

protected validateFileName(string $name): bool 

validateFileName validates a proposed media item file name.

protected validateFileType()

protected validateFileType(string $name): bool 

validateFileType checks for blocked / unsafe file extensions

Show inherited protected methods

Inherited Protected Methods