\Charcoal\Admin\TemplateElfinderTemplate

Base class for all `admin` Templates.

Available (mustache) methods

  • title (Translation) - The page title
  • subtitle (Translation) The page subtitle
  • showHeaderMenu (bool) - Display the header menu or not
  • headerMenu (iterator) - The header menu data
  • showFooterMenu (bool) - Display the footer menu or not
  • footerMenu (iterator) - The footer menu data

Summary

Methods
Properties
Constants
setDependencies()
init()
setIdent()
ident()
setLabel()
label()
setTitle()
title()
setSubtitle()
subtitle()
setShowTopHeaderMenu()
showTopHeaderMenu()
setTopHeaderMenu()
topHeaderMenu()
setShowHeaderMenu()
showHeaderMenu()
headerMenu()
setShowFooterMenu()
showFooterMenu()
footerMenu()
setShowSidemenu()
showSidemenu()
sidemenu()
isAuthenticated()
getAuthenticatedUser()
adminUrl()
setBaseUrl()
baseUrl()
headerMenuLogo()
siteName()
documentTitle()
devMode()
lang()
locale()
recaptchaKey()
hasFeedbacks()
numFeedbacks()
feedbacks()
addFeedback()
clearFeedback()
propertyFactory()
setLocalizations()
addLocalization()
removeLocalization()
numLocalizations()
hasLocalizations()
localizations()
localization()
elfinderLocalizationsAsJson()
adminAssetsUrl()
elfinderAssetsUrl()
elfinderAssets()
elfinderCallback()
objType()
objId()
propertyIdent()
formProperty()
elfinderConfigAsJson()
No public properties found
No constants found
setModelFactory()
modelFactory()
createHeaderMenu()
createSidemenu()
authRequired()
setSiteName()
setWidgetFactory()
widgetFactory()
resolveFeedbackLevel()
setPropertyFactory()
defaultLocalizations()
$baseUrl
$adminConfig
$appConfig
$label
$title
$subtitle
$headerMenu
$sidemenu
$feedbacks
$elfinderConfig
N/A
No private methods found
$siteName
$ident
$showSidemenu
$showHeaderMenu
$showFooterMenu
$showTopHeaderMenu
$modelFactory
$widgetFactory
$propertyFactory
$formProperty
$objType
$objId
$propertyIdent
$showAssets
$localizations
$callbackIdent
N/A

Properties

$baseUrl

$baseUrl : \Psr\Http\Message\UriInterface

The base URI.

Type

\Psr\Http\Message\UriInterface

$adminConfig

$adminConfig : \Charcoal\Admin\Config

Store a reference to the admin configuration.

Type

\Charcoal\Admin\Config

$appConfig

$appConfig : \Charcoal\App\Config

Store a reference to the application configuration.

Type

\Charcoal\App\Config

$label

$label : \Charcoal\Translator\Translation|string|null

Type

\Charcoal\Translator\Translation|string|null

$title

$title : \Charcoal\Translator\Translation|string|null

Type

\Charcoal\Translator\Translation|string|null

$subtitle

$subtitle : \Charcoal\Translator\Translation|string|null

Type

\Charcoal\Translator\Translation|string|null

$headerMenu

$headerMenu : boolean

Type

boolean

$sidemenu

$sidemenu : \Charcoal\Admin\SideMenuWidgetInterface

Type

\Charcoal\Admin\SideMenuWidgetInterface

$feedbacks

$feedbacks : array

Collection of feedback.

Type

array

$elfinderConfig

$elfinderConfig : \Charcoal\Config\ConfigInterface

Store the elFinder configuration from the admin configuration.

Type

\Charcoal\Config\ConfigInterface

$siteName

$siteName : \Charcoal\Translator\Translation|string|null

The name of the project.

Type

\Charcoal\Translator\Translation|string|null

$ident

$ident : string

Type

string

$showSidemenu

$showSidemenu : boolean

Type

boolean

$showHeaderMenu

$showHeaderMenu : boolean

Type

boolean

$showFooterMenu

$showFooterMenu : boolean

Type

boolean

$showTopHeaderMenu

$showTopHeaderMenu : boolean

Type

boolean

$modelFactory

$modelFactory : \Charcoal\Factory\FactoryInterface

Type

\Charcoal\Factory\FactoryInterface

$widgetFactory

$widgetFactory : \Charcoal\Factory\FactoryInterface

Type

\Charcoal\Factory\FactoryInterface

$propertyFactory

$propertyFactory : \Charcoal\Factory\FactoryInterface

Store the factory instance for the current class.

Type

\Charcoal\Factory\FactoryInterface

$formProperty

$formProperty : \Charcoal\Admin\Template\PropertyInterface

Store the current property instance for the current class.

Type

\Charcoal\Admin\Template\PropertyInterface

$objType

$objType : string

The related object type.

Type

string

$objId

$objId : string

The related object ID.

Type

string

$propertyIdent

$propertyIdent : string

The related property identifier.

Type

string

$showAssets

$showAssets : boolean

Whether to output JS/CSS assets for initializing elFinder.

Type

boolean

$localizations

$localizations : \Charcoal\Admin\Template\{\Charcoal\Translator\Translation|string|array<mixed,\Charcoal\Admin\Template\null}>|null

Custom localization messages.

Type

\Charcoal\Admin\Template\{\Charcoal\Translator\Translation|string|array<mixed,\Charcoal\Admin\Template\null}>|null

$callbackIdent

$callbackIdent : string

The related JS callback ID.

Type

string

Methods

setDependencies()

setDependencies(\Pimple\Container  $container) : void

Inject dependencies from a DI Container.

Parameters

\Pimple\Container $container

A dependencies container instance.

init()

init(\Psr\Http\Message\RequestInterface  $request) : boolean

Retrieve options from Request's parameters (GET).

For admin templates, initializations is:

  • to start a session, if necessary
  • to authenticate
  • to initialize the template data with $_GET

Parameters

\Psr\Http\Message\RequestInterface $request

The PSR7 request.

Returns

boolean

setIdent()

setIdent(mixed  $ident) : \Charcoal\Admin\AdminTemplate

Parameters

mixed $ident

Template identifier.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

ident()

ident() : string

Returns

string

setLabel()

setLabel(mixed  $label) : \Charcoal\Admin\AdminTemplate

Parameters

mixed $label

Template label.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

label()

label() : \Charcoal\Translator\Translation|string|null

Returns

\Charcoal\Translator\Translation|string|null

setTitle()

setTitle(mixed  $title) : \Charcoal\Admin\AdminTemplate

Set the title of the page.

Parameters

mixed $title

Template title.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

title()

title() : \Charcoal\Translator\Translation|string|null

Retrieve the title of the page.

Returns

\Charcoal\Translator\Translation|string|null

setSubtitle()

setSubtitle(mixed  $subtitle) : \Charcoal\Admin\AdminTemplate

Set the page's sub-title.

Parameters

mixed $subtitle

Template subtitle.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

subtitle()

subtitle() : \Charcoal\Translator\Translation|string|null

Retrieve the page's sub-title.

Returns

\Charcoal\Translator\Translation|string|null

setShowTopHeaderMenu()

setShowTopHeaderMenu(boolean  $bool) : \Charcoal\Admin\AdminTemplate

Display or not the top right header menu.

Parameters

boolean $bool

Display or not.

Returns

\Charcoal\Admin\AdminTemplate

Chainable.

showTopHeaderMenu()

showTopHeaderMenu() : boolean

Returns

boolean —

Show the top header menu or not.

setTopHeaderMenu()

setTopHeaderMenu(array  $menu) : \Charcoal\Admin\AdminTemplate

Sets the top right header menu.

Parameters

array $menu

Menu as link and labels.

Returns

\Charcoal\Admin\AdminTemplate

Chainable.

topHeaderMenu()

topHeaderMenu() : array

Header menu links and labels.

Returns

array —

The menu.

setShowHeaderMenu()

setShowHeaderMenu(boolean  $show) : \Charcoal\Admin\AdminTemplate

Parameters

boolean $show

The show header menu flag.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

showHeaderMenu()

showHeaderMenu() : boolean

Returns

boolean

headerMenu()

headerMenu() : array

Returns

array

setShowFooterMenu()

setShowFooterMenu(boolean  $show) : \Charcoal\Admin\AdminTemplate

Parameters

boolean $show

The show footer menu flag.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

showFooterMenu()

showFooterMenu() : boolean

Returns

boolean

footerMenu()

footerMenu() : array

Returns

array

setShowSidemenu()

setShowSidemenu(boolean  $show) : \Charcoal\Admin\AdminTemplate

Parameters

boolean $show

The show sidemenu flag.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

showSidemenu()

showSidemenu() : boolean

Returns

boolean

sidemenu()

sidemenu() : \Charcoal\Admin\SidemenuWidgetInterface|null

Retrieve the sidemenu.

Returns

\Charcoal\Admin\SidemenuWidgetInterface|null

isAuthenticated()

isAuthenticated() : boolean

Determine if the current user is authenticated.

Returns

boolean

getAuthenticatedUser()

getAuthenticatedUser() : \Charcoal\User\UserInterface|null

Retrieve the currently authenticated user.

Returns

\Charcoal\User\UserInterface|null

adminUrl()

adminUrl() : \Psr\Http\Message\UriInterface|string

Retrieve the base URI of the administration area.

Returns

\Psr\Http\Message\UriInterface|string

setBaseUrl()

setBaseUrl(\Psr\Http\Message\UriInterface|string  $uri) : self

Set the base URI of the application.

Parameters

\Psr\Http\Message\UriInterface|string $uri

The base URI.

Returns

self

baseUrl()

baseUrl() : \Psr\Http\Message\UriInterface|string

Retrieve the base URI of the application.

Returns

\Psr\Http\Message\UriInterface|string

headerMenuLogo()

headerMenuLogo() : string

Returns

string

siteName()

siteName() : \Charcoal\Translator\Translation|string|null

Retrieve the name of the project.

Returns

\Charcoal\Translator\Translation|string|null

documentTitle()

documentTitle() : \Charcoal\Translator\Translation|string|null

Retrieve the document title.

Returns

\Charcoal\Translator\Translation|string|null

devMode()

devMode() : boolean

Application Debug Mode.

Returns

boolean

lang()

lang() : string

Retrieve the current language.

Returns

string

locale()

locale() : string

Retrieve the current language.

Returns

string

recaptchaKey()

recaptchaKey() : string

Returns

string

hasFeedbacks()

hasFeedbacks() : boolean

Determine if there's feedback.

Returns

boolean

numFeedbacks()

numFeedbacks() : integer

Count feedback.

Returns

integer

feedbacks()

feedbacks(string|null  $level = null) : array

Retrieve the feedback collection.

Optionally retrieve only the feedback for the given level.

Parameters

string|null $level

Optional level to filter collection.

Throws

\InvalidArgumentException

If the feedback level is invalid.

Returns

array

addFeedback()

addFeedback(string  $level, mixed  $message) : \Charcoal\Admin\Ui\FeedbackContainerTrait

Add feedback.

Parameters

string $level

The feedback level.

mixed $message

The feedback message.

Returns

\Charcoal\Admin\Ui\FeedbackContainerTrait

Chainable

propertyFactory()

propertyFactory() : \Charcoal\Factory\FactoryInterface

Retrieve the property factory.

Throws

\RuntimeException

If the property factory was not previously set.

Returns

\Charcoal\Factory\FactoryInterface

setLocalizations()

setLocalizations(array  $localizations) : self

Set the custom localization messages.

Parameters

array $localizations

An associative array of localizations.

Returns

self

addLocalization()

addLocalization(string  $ident, mixed  $translations) : self

Add a custom localization message.

Parameters

string $ident

The message ID.

mixed $translations

The message translations.

Throws

\InvalidArgumentException

If the message ID is not a string or the translations are invalid.

Returns

self

removeLocalization()

removeLocalization(string  $ident) : self

Remove the translations for the given message ID.

Parameters

string $ident

The message ID to remove.

Throws

\InvalidArgumentException

If the message ID is not a string.

Returns

self

numLocalizations()

numLocalizations() : integer

Count the number of localizations.

Returns

integer

hasLocalizations()

hasLocalizations() : boolean

Determine if there are any localizations.

Returns

boolean

localizations()

localizations() : \Charcoal\Admin\Template\{\Charcoal\Translator\Translation|array<mixed,\Charcoal\Admin\Template\string}>|null

Retrieve the localizations.

Returns

\Charcoal\Admin\Template\{\Charcoal\Translator\Translation|array<mixed,\Charcoal\Admin\Template\string}>|null

localization()

localization(string  $ident) : \Charcoal\Translator\Translation|string|null

Retrieve the translations for the given message ID.

Parameters

string $ident

The message ID to lookup.

Throws

\InvalidArgumentException

If the message ID is not a string.

Returns

\Charcoal\Translator\Translation|string|null

elfinderLocalizationsAsJson()

elfinderLocalizationsAsJson() : string

Retrieve the custom localizations for elFinder.

Returns

string —

Returns data serialized with {@see json_encode()}.

adminAssetsUrl()

adminAssetsUrl() : string

Returns

string

elfinderAssetsUrl()

elfinderAssetsUrl() : string

Returns

string

elfinderAssets()

elfinderAssets() : string

Returns

string

elfinderCallback()

elfinderCallback() : string|null

Retrieve the current elFinder callback ID from the GET parameters.

Returns

string|null

objType()

objType() : string|null

Retrieve the current object type from the GET parameters.

Returns

string|null

objId()

objId() : string|null

Retrieve the current object ID from the GET parameters.

Returns

string|null

propertyIdent()

propertyIdent() : string|null

Retrieve the current object's property identifier from the GET parameters.

Returns

string|null

formProperty()

formProperty() : \Charcoal\Admin\Template\PropertyInterface

Retrieve the current property.

Returns

\Charcoal\Admin\Template\PropertyInterface

elfinderConfigAsJson()

elfinderConfigAsJson() : string

Retrieve the current property's client-side settings for elFinder.

Returns

string —

Returns data serialized with {@see json_encode()}.

setModelFactory()

setModelFactory(\Charcoal\Factory\FactoryInterface  $factory) : void

As a convenience, all admin templates have a model factory to easily create objects.

Parameters

\Charcoal\Factory\FactoryInterface $factory

The factory used to create models.

modelFactory()

modelFactory() : \Charcoal\Factory\FactoryInterface

Throws

\Exception

If the factory is not set.

Returns

\Charcoal\Factory\FactoryInterface —

The model factory.

createHeaderMenu()

createHeaderMenu(mixed  $options = null) : array

Parameters

mixed $options

The sidemenu widget ID or config.

Throws

\InvalidArgumentException

If the menu is missing, invalid, or malformed.

Returns

array

createSidemenu()

createSidemenu(mixed  $options = null) : \Charcoal\Admin\SidemenuWidgetInterface|null

Parameters

mixed $options

The sidemenu widget ID or config.

Throws

\InvalidArgumentException

If the sidemenu widget is invalid.

Returns

\Charcoal\Admin\SidemenuWidgetInterface|null

authRequired()

authRequired() : boolean

Determine if user authentication is required.

Authentication is required by default. If unnecessary, replace this method in the inherited template class.

For example, the "Login" / "Reset Password" templates should return false.

Returns

boolean

setSiteName()

setSiteName(string  $name) : \Charcoal\Admin\AdminTemplate

Set the name of the project.

Parameters

string $name

Name of the project.

Returns

\Charcoal\Admin\AdminTemplate

Chainable

setWidgetFactory()

setWidgetFactory(\Charcoal\Factory\FactoryInterface  $factory) : void

Parameters

\Charcoal\Factory\FactoryInterface $factory

The widget factory, to create the dashboard and sidemenu widgets.

widgetFactory()

widgetFactory() : \Charcoal\Factory\FactoryInterface

Throws

\Exception

If the widget factory dependency was not previously set / injected.

Returns

\Charcoal\Factory\FactoryInterface

resolveFeedbackLevel()

resolveFeedbackLevel(string  $level) : string

Resolve the given feedback level.

Parameters

string $level

The feedback level.

Returns

string —

The level.

setPropertyFactory()

setPropertyFactory(\Charcoal\Factory\FactoryInterface  $factory) : self

Set a property factory.

Parameters

\Charcoal\Factory\FactoryInterface $factory

The property factory, to createable property values.

Returns

self

defaultLocalizations()

defaultLocalizations() : \Charcoal\Translator\Translation|string|null

Retrieve the default custom localizations.

Returns

\Charcoal\Translator\Translation|string|null