Properties

$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

$feedbacks

$feedbacks : array

Collection of feedback.

Type

array

$baseUrl

$baseUrl : \Psr\Http\Message\UriInterface|string

The base URI for the Charcoal application.

Type

\Psr\Http\Message\UriInterface|string

$uploadPath

$uploadPath : string

The relative path (from filesystem's root) to the storage directory.

Type

string

$elfinderConfig

$elfinderConfig : \Charcoal\Config\ConfigInterface

Store the elFinder configuration from the admin configuration.

Type

\Charcoal\Config\ConfigInterface

$elfinderOptions

$elfinderOptions : array

The elFinder class settings.

Type

array — - {@link https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options}

$siteName

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

The name of the project.

Type

\Charcoal\Translator\Translation|string|null

$modelFactory

$modelFactory : \Charcoal\Factory\FactoryInterface

Store the model factory.

Type

\Charcoal\Factory\FactoryInterface

$propertyFactory

$propertyFactory : \Charcoal\Factory\FactoryInterface

Store the factory instance for the current class.

Type

\Charcoal\Factory\FactoryInterface

$formProperty

$formProperty : \Charcoal\Property\PropertyInterface

Store the current property instance for the current class.

Type

\Charcoal\Property\PropertyInterface

Methods

__construct()

__construct(array  $data = null) 

Parameters

array $data

Optional.

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

Template's init method is called automatically from `charcoal-app`'s Template Route.

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 request to initialize.

Returns

boolean

siteName()

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

Retrieve the name of the project.

Returns

\Charcoal\Translator\Translation|string|null

authRequired()

authRequired() : boolean

Authentication is required by default.

Reimplement and change to false in templates that do not require authentication.

Returns

boolean

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

results()

results() : array

Default response stub.

Returns

array

adminUrl()

adminUrl() : \Charcoal\Admin\UriInterface|string

Retrieve the base URI of the administration area.

Returns

\Charcoal\Admin\UriInterface|string

setBaseUrl()

setBaseUrl(\Charcoal\Admin\UriInterface|string  $uri) : self

Set the base URI of the application.

Parameters

\Charcoal\Admin\UriInterface|string $uri

The base URI.

Returns

self

baseUrl()

baseUrl() : \Charcoal\Admin\UriInterface|string

Retrieve the base URI of the application.

Returns

\Charcoal\Admin\UriInterface|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

run()

run(\Psr\Http\Message\RequestInterface  $request, \Psr\Http\Message\ResponseInterface  $response) : \Psr\Http\Message\ResponseInterface

Parameters

\Psr\Http\Message\RequestInterface $request

A PSR-7 compatible Request instance.

\Psr\Http\Message\ResponseInterface $response

A PSR-7 compatible Response instance.

Returns

\Psr\Http\Message\ResponseInterface

setupElfinder()

setupElfinder(array|null  $extraOptions = array()) : \elFinderConnector

Setup the elFinder connector.

Parameters

array|null $extraOptions

Additional settings to pass to elFinder.

Returns

\elFinderConnector

connectorOptions()

connectorOptions(array|null  $extraOptions = array()) : array

Retrieve the default elFinder Connector options.

Parameters

array|null $extraOptions

Additional settings to pass to elFinder.

Returns

array

Examples

The Connector can be customized by defining a "elfinder" structure in your application's admin configuration.
** File not found : https://gist.github.com/mcaskill/5944478b1894a5bf1349bfa699387cd4 **

defaultConnectorOptions()

defaultConnectorOptions() : array

Retrieve the default elFinder Connector options from the configured flysystem filesystems.

Returns

array

Examples

The Connector can be customized by defining a "elfinder" structure in your application's admin configuration.
** File not found : https://gist.github.com/mcaskill/5944478b1894a5bf1349bfa699387cd4 **

sanitizeOnUploadPreSave()

sanitizeOnUploadPreSave(string  $path, string  $name, string  $src, object  $elfinder, object  $volume) : true

Trim a file name.

Parameters

string $path

The target path.

string $name

The target name.

string $src

The temporary file name.

object $elfinder

The elFinder instance.

object $volume

The current volume instance.

Returns

true

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\Property\PropertyInterface

Retrieve the current property.

Returns

\Charcoal\Property\PropertyInterface

uploadPath()

uploadPath() : string

Retrieve the default root path.

Returns

string

setModelFactory()

setModelFactory(\Charcoal\Factory\FactoryInterface  $factory) : \Charcoal\Admin\AdminScript

Parameters

\Charcoal\Factory\FactoryInterface $factory

The factory used to create models.

Returns

\Charcoal\Admin\AdminScript

Chainable

modelFactory()

modelFactory() : \Charcoal\Factory\FactoryInterface

Returns

\Charcoal\Factory\FactoryInterface —

The model factory.

setSiteName()

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

Set the name of the project.

Parameters

string $name

Name of the project.

Returns

\Charcoal\Admin\AdminAction

Chainable

validateCaptcha()

validateCaptcha(string  $response) : boolean

Parameters

string $response

The captcha value (response) to validate.

Throws

\RuntimeException

If Google reCAPTCHA is not configured.

Returns

boolean

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

resolveBoundCallbacks()

resolveBoundCallbacks(array  $toResolve) : array

Resolve elFinder event listeners.

Parameters

array $toResolve

One or many pairs of callbacks.

Returns

array —

Returns the parsed event listeners.

defaultUploadAllow()

defaultUploadAllow() : array

Default acceptable files to upload.

Returns

array

attributesForHiddenFiles()

attributesForHiddenFiles() : array

Default attributes for files and directories.

Returns

array