Media\Widgets\MediaManager
Overview
MediaManager widget
Extends
Implements
- Larajax\Contracts\ViewComponentInterface
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
- $implement - extensions for this class. (defined in October\Rain\Extension\Extendable)
- $vars - is a list of variables to pass to the page. (defined in Backend\Classes\WidgetBase)
- $layout - to use for the view. (defined in Backend\Classes\WidgetBase)
- $suppressLayout - prevents the use of a layout. (defined in Backend\Classes\WidgetBase)
- $assetPath - specifies the relative path to the asset directory. (defined in Backend\Classes\WidgetBase)
- $assetUrlPath - specifies the public path to the asset directory. (defined in Backend\Classes\WidgetBase)
- $config - supplied. (defined in Backend\Classes\WidgetBase)
- $alias - defined for this widget. (defined in Backend\Classes\WidgetBase)
- $controller - object. (defined in Backend\Classes\WidgetBase)
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
- $extensionData - contains class reflection information, including behaviors. (defined in October\Rain\Extension\Extendable)
- $extendableStaticMethods - is a collection of static methods used by behaviors. (defined in October\Rain\Extension\Extendable)
- $viewPath - specifies a path to the views directory. (defined in Backend\Classes\WidgetBase)
- $layoutPath - specifies a path to the layout directory. (defined in Backend\Classes\WidgetBase)
- $viewPathGuessCache - remembers path guesses for performance. (defined in Backend\Classes\WidgetBase)
- $assets - Collection of assets to display in the layout. (defined in Backend\Classes\WidgetBase)
- $assetBundles - Collection of combined and prioritized assets. (defined in Backend\Classes\WidgetBase)
- $assetDefaults - is the default attributes for assets. (defined in Backend\Classes\WidgetBase)
- $configPath - specifies a path to the config directory. (defined in Backend\Classes\WidgetBase)
- $emitterSingleEventCollection - of events to be fired once only. (defined in Backend\Classes\WidgetBase)
- $emitterEventCollection - of all registered events. (defined in Backend\Classes\WidgetBase)
- $emitterEventSorted - collection. (defined in Backend\Classes\WidgetBase)
- $fatalError - stores the object used for a fatal error. (defined in Backend\Classes\WidgetBase)
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 onCheckFilesExist()
public onCheckFilesExist(): array
onCheckFilesExist checks which files already exist in the target folder
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.
Inherited Public Methods
- __call() - calls an undefined local method. (defined in October\Rain\Extension\Extendable)
- __callStatic() - calls an undefined static method. (defined in October\Rain\Extension\Extendable)
- __get() - an undefined property. (defined in October\Rain\Extension\Extendable)
- __set() - an undefined property. (defined in October\Rain\Extension\Extendable)
- __sleep() - prepare the object for serialization. (defined in October\Rain\Extension\Extendable)
- __wakeup() - when a model is being unserialized, check if it needs to be booted. (defined in October\Rain\Extension\Extendable)
- addCss() - includes a StyleSheet asset to the asset list. (defined in Backend\Classes\WidgetBase)
- addCssBundle() - includes a CSS asset to the bundled combiner pipeline. (defined in Backend\Classes\WidgetBase)
- addDynamicMethod() - programmatically adds a method to the extendable class. (defined in October\Rain\Extension\Extendable)
- addDynamicProperty() - programmatically adds a property to the extendable class. (defined in October\Rain\Extension\Extendable)
- addJs() - includes a JavaScript asset to the asset list. (defined in Backend\Classes\WidgetBase)
- addJsBundle() - includes a JS asset to the bundled combiner pipeline. (defined in Backend\Classes\WidgetBase)
- addRss() - adds an RSS link asset to the asset list. Call $this->makeAssets(). (defined in Backend\Classes\WidgetBase)
- addViewPath() - prepends a path on the available view path locations. (defined in Backend\Classes\WidgetBase)
- asExtension() - is short hand for
getClassExtension()method, except takes the short. (defined in October\Rain\Extension\Extendable) - bindEvent() - creates a new event binding. (defined in Backend\Classes\WidgetBase)
- bindEventOnce() - creates a new event binding that fires once only. (defined in Backend\Classes\WidgetBase)
- bindToController() - (defined in Backend\Classes\WidgetBase)
- clearExtendedClasses() - (defined in October\Rain\Extension\Extendable)
- combineAssets() - runs asset paths through the Asset Combiner. (defined in Backend\Classes\WidgetBase)
- createIn() - builds a component instance against the given controller, (defined in Backend\Classes\WidgetBase)
- extend() - this class with a closure. (defined in October\Rain\Extension\Extendable)
- extendClassWith() - dynamically extends a class with a specified behavior. (defined in October\Rain\Extension\Extendable)
- extendableCall() - magic method for
__call(). (defined in October\Rain\Extension\Extendable) - extendableCallStatic() - magic method for
__callStatic(). (defined in October\Rain\Extension\Extendable) - extendableConstruct() - should be called as part of the constructor. (defined in October\Rain\Extension\Extendable)
- extendableDestruct() - should be called when serializing the object. (defined in October\Rain\Extension\Extendable)
- extendableExtendCallback() - is a helper method for
::extend()static method. (defined in October\Rain\Extension\Extendable) - extendableGet() - magic method for
__get(). (defined in October\Rain\Extension\Extendable) - extendableSet() - magic method for
__set(). (defined in October\Rain\Extension\Extendable) - fireEvent() - and call the listeners. (defined in Backend\Classes\WidgetBase)
- fireSystemEvent() - fires a combination of local and global events. The first segment is removed. (defined in Backend\Classes\WidgetBase)
- fireViewEvent() - is a special event function used for extending within view files, (defined in Backend\Classes\WidgetBase)
- flushAssets() - disables the use, and subsequent broadcast, of assets. This is useful. (defined in Backend\Classes\WidgetBase)
- getAssetPath() - locates a file based on it's definition. If the file starts with. (defined in Backend\Classes\WidgetBase)
- getAssetPaths() - returns an array of all registered asset paths. (defined in Backend\Classes\WidgetBase)
- getAssetPathsWithAttributes() - returns an array of all registered asset paths. (defined in Backend\Classes\WidgetBase)
- getClassExtension() - returns a behavior object from an extendable class, example:. (defined in October\Rain\Extension\Extendable)
- getClassMethodAsReflector() - (defined in October\Rain\Extension\Extendable)
- getClassMethods() - gets a list of class methods, extension equivalent of get_class_methods(). (defined in October\Rain\Extension\Extendable)
- getConfig() - is a safe accessor for configuration values. (defined in Backend\Classes\WidgetBase)
- getConfigPath() - locates a file based on it's definition. If the file starts with. (defined in Backend\Classes\WidgetBase)
- getController() - returns the controller using this widget. (defined in Backend\Classes\WidgetBase)
- getDynamicProperties() - returns all dynamic properties and their values. (defined in October\Rain\Extension\Extendable)
- getEventHandler() - returns a fully qualified event handler name for this widget. (defined in Backend\Classes\WidgetBase)
- getFatalError() - returns error message. (defined in Backend\Classes\WidgetBase)
- getId() - returns a unique ID for this widget. Useful in creating HTML markup. (defined in Backend\Classes\WidgetBase)
- getViewPath() - locates a file based on its definition. The file name can be prefixed. (defined in Backend\Classes\WidgetBase)
- getViewPaths() - returns the active view path locations. (defined in Backend\Classes\WidgetBase)
- getWidget() - (defined in Backend\Classes\WidgetBase)
- guessConfigPath() - guesses the package path for the called class. (defined in Backend\Classes\WidgetBase)
- guessConfigPathFrom() - guesses the package path from a specified class. (defined in Backend\Classes\WidgetBase)
- guessViewPath() - guesses the package path for the called class. (defined in Backend\Classes\WidgetBase)
- guessViewPathFrom() - guesses the package path from a specified class, including. (defined in Backend\Classes\WidgetBase)
- handleError() - sets standard page variables in the case of a controller error. (defined in Backend\Classes\WidgetBase)
- hasAssetsDefined() - returns true if assets any have been added. (defined in Backend\Classes\WidgetBase)
- hasFatalError() - returns true if a fatal error has been set. (defined in Backend\Classes\WidgetBase)
- implementClassWith() - will implement an extension using non-interference and should. (defined in October\Rain\Extension\Extendable)
- init() - the widget, called by the constructor and free from its parameters. (defined in Backend\Classes\WidgetBase)
- isClassExtendedWith() - checks if extendable class is extended with a behavior object. (defined in October\Rain\Extension\Extendable)
- isClassInstanceOf() - checks if the class implements the supplied interface methods. (defined in October\Rain\Extension\Extendable)
- make() - builds the component and binds it to the current controller. (defined in Backend\Classes\WidgetBase)
- makeAssets() - outputs
<link>and<script>tags to load assets previously added with addJs and addCss method calls. (defined in Backend\Classes\WidgetBase) - makeConfig() - reads the contents of the supplied file and applies it to this object. (defined in Backend\Classes\WidgetBase)
- makeConfigFromArray() - makes a config object from an array, making the first. (defined in Backend\Classes\WidgetBase)
- makeFileContents() - includes a file path using output buffering. (defined in Backend\Classes\WidgetBase)
- makeFormWidget() - object with the supplied form field and widget configuration. (defined in Backend\Classes\WidgetBase)
- makeLayout() - renders a layout. (defined in Backend\Classes\WidgetBase)
- makeLayoutPartial() - renders a layout partial. (defined in Backend\Classes\WidgetBase)
- makePartial() - renders a partial file contents located in the views folder. (defined in Backend\Classes\WidgetBase)
- makeView() - loads a view with the name specified. Applies layout if its name is provided. (defined in Backend\Classes\WidgetBase)
- makeViewContent() - renders supplied contents inside a layout. (defined in Backend\Classes\WidgetBase)
- makeWidget() - object with the supplied configuration file. (defined in Backend\Classes\WidgetBase)
- mergeConfig() - merges two configuration sources, either prepared or not, and returns. (defined in Backend\Classes\WidgetBase)
- methodExists() - checks if a method exists, extension equivalent of method_exists(). (defined in October\Rain\Extension\Extendable)
- propertyExists() - checks if a property exists, extension equivalent of
property_exists(). (defined in October\Rain\Extension\Extendable) - resetSession() - Resets all session data related to this widget. (defined in Backend\Classes\WidgetBase)
- unbindEvent() - destroys an event binding. (defined in Backend\Classes\WidgetBase)
Protected Methods
protected checkDuplicateFile()
protected checkDuplicateFile($realPath, $filePath, $quickMode): bool
checkDuplicateFile checks if a file already exists and handles accordingly. Returns true if the upload should be halted (response already set).
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 getUploadMaxFilesize()
protected getUploadMaxFilesize(): float
getUploadMaxFilesize returns max upload filesize in MB
protected getViewMode()
protected getViewMode(): string
getViewMode returns the current view mode stored in the session
protected isAutoRenameEnabled()
protected isAutoRenameEnabled(): bool
isAutoRenameEnabled checks if media item names should be slugged automatically.
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
- combineBundledAssets() - spins over every bundle definition and combines them to an asset. (defined in Backend\Classes\WidgetBase)
- emitterEventSortEvents() - sorts the listeners for a given event by priority. (defined in Backend\Classes\WidgetBase)
- extendableIsAccessible() - checks if a property is accessible, property equivalent. (defined in October\Rain\Extension\Extendable)
- extensionExtractImplements() - will return classes to implement. (defined in October\Rain\Extension\Extendable)
- extensionExtractMethods() - extracts the available methods from a behavior and adds it. (defined in October\Rain\Extension\Extendable)
- fillFromConfig() - transfers config values stored inside the $config property directly. (defined in Backend\Classes\WidgetBase)
- getAssetEntryBuildPath() - is an internal marker that returns the asset path. (defined in Backend\Classes\WidgetBase)
- getAssetScheme() - is an internal helper to get the asset scheme. (defined in Backend\Classes\WidgetBase)
- getConfigValueFrom() - will apply the config getter convention. (defined in Backend\Classes\WidgetBase)
- getExtendableMethodFromDynamicMethods() - (defined in October\Rain\Extension\Extendable)
- getExtendableMethodFromExtensions() - (defined in October\Rain\Extension\Extendable)
- getLocalPath() - converts a relative path to a local path. (defined in Backend\Classes\WidgetBase)
- getSession() - Retrieves a widget related key/value pair from session data. (defined in Backend\Classes\WidgetBase)
- handleViewException() - handles a view exception. (defined in Backend\Classes\WidgetBase)
- makeSessionId() - Returns a unique session identifier for this widget and controller action. (defined in Backend\Classes\WidgetBase)
- processAssetAttributes() - (defined in Backend\Classes\WidgetBase)
- putSession() - Saves a widget related key/value pair in to session data. (defined in Backend\Classes\WidgetBase)
- readSessionStore() - Reads the widget session store, preferring JSON and falling back to. (defined in Backend\Classes\WidgetBase)
- removeDuplicateAssets() - removes duplicate and global assets from the entire collection. (defined in Backend\Classes\WidgetBase)
- renderAssetAttributes() - takes an asset definition and returns the necessary HTML output. (defined in Backend\Classes\WidgetBase)