-
Docs
Backend
-
Behaviors
-
Classes
-
Controllers
-
Database
-
Seeds
-
-
Facades
-
FormWidgets
-
Helpers
-
Exception
- Backend
-
-
Models
-
ReportWidgets
-
Skins
-
Traits
-
Widgets
- ServiceProvider
-
-
Cms
-
Classes
- Asset
- AutoDatasource
- CmsCompoundObject
- CmsController
- CmsException
- CmsObject
- CmsObjectCollection
- CodeBase
- CodeParser
- ComponentBase
- ComponentHelpers
- ComponentManager
- ComponentPartial
- Content
- Controller
- Layout
- LayoutCode
- MediaLibrary
- MediaLibraryItem
- MediaViewHelper
- Meta
- ObjectMemoryCache
- Page
- PageCode
- Partial
- PartialCode
- PartialStack
- Router
- Theme
- ThemeManager
-
Components
-
Contracts
-
Controllers
-
Facades
-
FormWidgets
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ComponentNode
- ComponentTokenParser
- ContentNode
- ContentTokenParser
- DebugExtension
- DefaultNode
- DefaultTokenParser
- Extension
- FlashNode
- FlashTokenParser
- FrameworkNode
- FrameworkTokenParser
- Loader
- PageNode
- PageTokenParser
- PartialNode
- PartialTokenParser
- PlaceholderNode
- PlaceholderTokenParser
- PutNode
- PutTokenParser
- ScriptsNode
- ScriptsTokenParser
- StylesNode
- StylesTokenParser
-
Widgets
- ServiceProvider
-
-
System
-
Behaviors
-
Classes
-
Console
-
Controllers
-
Database
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ServiceProvider
-
-
Events
-
backend
-
ajax
-
filter
-
form
-
list
-
menu
-
page
-
user
-
-
cms
-
ajax
-
block
-
combiner
-
component
-
object
-
page
-
router
-
template
-
theme
-
-
halcyon
-
datasource
-
-
mailer
-
media
-
model
-
system
-
assets
-
console
-
mirror
-
theme
-
-
reportwidgets
-
settings
- extendConfigFile
-
-
translator
-
-
Library
-
Argon
-
Auth
-
Models
- AuthException
- Manager
-
-
Config
-
Cookie
-
Middleware
-
-
Database
-
Attach
-
Behaviors
-
Concerns
-
Connections
-
Connectors
-
Models
-
Relations
-
Schema
-
Traits
-
Updates
- README
- Builder
- Collection
- DatabaseServiceProvider
- DataFeed
- Dongle
- MemoryCache
- Model
- ModelBehavior
- ModelException
- NestedTreeScope
- Pivot
- QueryBuilder
- SortableScope
- TreeCollection
- Updater
-
-
Events
-
Exception
-
Extension
-
Filesystem
-
Flash
-
Foundation
-
Bootstrap
-
Console
-
Exception
-
Http
-
Middleware
- Kernel
-
-
Providers
- Application
- Maker
-
-
Halcyon
-
Datasource
-
Exception
-
Processors
-
Traits
- README
- Builder
- Collection
- HalcyonServiceProvider
- MemoryCacheManager
- MemoryRepository
- Model
-
-
Html
-
Mail
-
Network
-
Parse
-
Router
-
Scaffold
-
Support
-
Translation
-
- Documentation
- API
- Backend
- Classes
- Controller
Backend\Classes\Controller
Source: ~/modules/backend/classes/Controller.php
Extends:
- Illuminate\Routing\Controller
The Backend base controller class, used by Backend controllers. The base controller services back end pages.
Public properties
public array $implement
Behaviors implemented by this controller.
public array $widget
Collection of WidgetBase objects used on this page.
public bool $suppressView
Prevents the automatic view display.
public string $pageTitle
Page title
public string $pageTitleTemplate
Page title template
public string $bodyClass
Body class property used for customising the layout on a controller basis.
public array $hiddenActions
Default methods which cannot be called as actions.
public array $vars
A list of variables to pass to the page.
public string $layout
Layout to use for the view.
public bool $suppressLayout
Prevents the use of a layout.
public string $assetPath
Specifies a path to the asset directory.
Protected properties
protected object $user
Reference the logged in admin user.
protected array $params
Routed parameters.
protected string $action
Page action being called.
protected array $publicActions
Defines a collection of actions available without authentication.
protected array $requiredPermissions
Permissions required to view this page.
protected array $guarded
Controller specified methods which cannot be called as actions.
protected string|array $viewPath
Specifies a path to the views directory.
protected string $layoutPath
Specifies a path to the layout directory.
protected array $assets
Collection of assets to display in the layout.
protected string $configPath
Specifies a path to the config directory.
protected array $emitterSingleEventCollection
Collection of registered events to be fired once only.
protected array $emitterEventCollection
Collection of registered events.
protected array $emitterEventSorted
Sorted collection of events.
protected int $statusCode
Response status code
protected mixed $responseOverride
Override the standard controller response.
protected Symfony\Component\HttpFoundation\ResponseHeaderBag $responseHeaderBag
protected string $fatalError
Object used for storing a fatal error.
protected array $extensionData
Class reflection information, including behaviors.
protected static array $extendableCallbacks
Used to extend the constructor of an extendable class. Eg:
Class::extend(function($obj) { })
protected static array $extendableStaticMethods
Collection of static methods used by behaviors.
protected static bool $extendableGuardProperties
Indicates if dynamic properties can be created.
Show inherited protected properties
Inherited protected properties
- protected array $middleware - defined in Illuminate\Routing\Controller. The middleware registered on the controller.
Public methods
public void __call($name, $params)
Parameters
- $name
- $params
public static void __callStatic($name, $params)
Parameters
- $name
- $params
public void __construct()
Constructor.
public void __get($name)
Parameters
- $name
public void __set($name, $value)
Parameters
- $name
- $value
public boolean actionExists(string $name, bool $internal=false)
This method is used internally. Determines whether an action with the specified name exists. Action must be a class public method. Action name can not be prefixed with the underscore character.
Parameters
- string $name - Specifies the action name.
- bool $internal - Allow protected actions.
public void actionUrl($action=NULL, $path=NULL)
Returns a URL for this controller and supplied action.
Parameters
- $action
- $path
public void addCss(string $name, array $attributes=array())
Adds StyleSheet asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
Parameters
- string $name - Specifies a path (URL) to the script.
- array $attributes - Adds extra HTML attributes to the asset link.
public void addDynamicMethod(string $dynamicName, callable $method, string $extension=NULL)
Programmatically adds a method to the extendable class
Parameters
- string $dynamicName
- callable $method
- string $extension
public void addDynamicProperty(string $dynamicName, string $value=NULL)
Programmatically adds a property to the extendable class
Parameters
- string $dynamicName
- string $value
public void addJs(string $name, array $attributes=array())
Adds JavaScript asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
Parameters
- string $name - Specifies a path (URL) to the script.
- array $attributes - Adds extra HTML attributes to the asset link.
public void addRss(string $name, array $attributes=array())
Adds an RSS link asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
Parameters
- string $name - Specifies a path (URL) to the RSS channel
- array $attributes - Adds extra HTML attributes to the asset link.
public void addViewPath(string|array $path)
Prepends a path on the available view path locations.
Parameters
- string|array $path
public mixed asExtension(string $shortName)
Short hand for getClassExtension()
method, except takes the short
extension name, example:
$this->asExtension('FormController')
Parameters
- string $shortName
public self bindEvent($event, $callback, $priority=0)
Create a new event binding.
Parameters
- $event
- $callback
- $priority
public self bindEventOnce($event, $callback)
Create a new event binding that fires once only
Parameters
- $event
- $callback
public static void clearExtendedClasses()
Clear the list of extended classes so they will be re-extended.
public string combineAssets(array $assets, string $localPath='')
Run the provided assets through the Asset Combiner
Parameters
- array $assets - Collection of assets
- string $localPath - Prefix all assets with this path (optional)
public static void extend($callback)
Extend this object properties upon construction.
Parameters
- $callback
public void extendClassWith(string $extensionName)
Dynamically extend a class with a specified behavior
Parameters
- string $extensionName
public mixed extendableCall(string $name, array $params=NULL)
Magic method for __call()
Parameters
- string $name
- array $params
public static mixed extendableCallStatic(string $name, array $params=NULL)
Magic method for __callStatic()
Parameters
- string $name
- array $params
public void extendableConstruct()
This method should be called as part of the constructor.
public static void extendableExtendCallback(callable $callback)
Helper method for ::extend()
static method
Parameters
- callable $callback
public string extendableGet(string $name)
Magic method for __get()
Parameters
- string $name
public string extendableSet(string $name, string $value)
Magic method for __set()
Parameters
- string $name
- string $value
public array fireEvent(string $event, array $params=array(), boolean $halt=false)
Fire an event and call the listeners.
Parameters
- string $event - Event name
- array $params - Event parameters
- boolean $halt - Halt after first non-null result
public mixed fireSystemEvent(string $event, array $params=array(), boolean $halt=true)
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);
Parameters
- string $event - Event name
- array $params - Event parameters
- boolean $halt - Halt after first non-null result
public string fireViewEvent(string $event, array $params=array())
Special event function used for extending within view files, allowing HTML to be injected multiple times.
For example:
<?= $this->fireViewEvent('backend.auth.extendSigninView') ?>
Parameters
- string $event - Event name
- array $params - Event parameters
public void flushAssets()
Disables the use, and subequent broadcast, of assets. This is useful to call during an AJAX request to speed things up. This method works by specifically targeting the hasAssetsDefined method.
public string getAjaxHandler()
Returns the AJAX handler for the current request, if available.
public string getAssetPath(string $fileName, string $assetPath=NULL)
Locates a file based on it's definition. If the file starts with a forward slash, it will be returned in context of the application public path, otherwise it will be returned in context of the asset path.
Parameters
- string $fileName - File to load.
- string $assetPath - Explicitly define an asset path.
public array getAssetPaths()
Returns an array of all registered asset paths.
public mixed getClassExtension(string $name)
Returns a behavior object from an extendable class, example:
$this->getClassExtension('Backend.Behaviors.FormController')
Parameters
- string $name - Fully qualified behavior name
public array getClassMethods()
Get a list of class methods, extension equivalent of get_class_methods()
public string getConfigPath(string $fileName, mixed $configPath=NULL)
Locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path.
Parameters
- string $fileName - File to load.
- mixed $configPath - Explicitly define a config path.
public array getDynamicProperties()
Returns all dynamic properties and their values
public string getFatalError()
public void getId($suffix=NULL)
Returns a unique ID for the controller and route. Useful in creating HTML markup.
Parameters
- $suffix
public void getPublicActions()
Returns the controllers public actions.
public Symfony\Component\HttpFoundation\ResponseHeaderBag|null getResponseHeaders()
Get the header response bag
public int getStatusCode()
Returns the status code for the current web response.
public string getViewPath(string $fileName, mixed $viewPath=NULL)
Locates a file based on its definition. The file name can be prefixed with a symbol (~|$) to return in context of the application or plugin base path, otherwise it will be returned in context of this object view path.
Parameters
- string $fileName - File to load.
- mixed $viewPath - Explicitly define a view path.
public array getViewPaths()
Returns the active view path locations.
public string guessConfigPath(string $suffix='')
Guess the package path for the called class.
Parameters
- string $suffix - An extra path to attach to the end
public string guessConfigPathFrom(string $class, string $suffix='')
Guess the package path from a specified class.
Parameters
- string $class - Class to guess path from.
- string $suffix - An extra path to attach to the end
public string guessViewPath(string $suffix='', bool $isPublic=false)
Guess the package path for the called class.
Parameters
- string $suffix - An extra path to attach to the end
- bool $isPublic - Returns public path instead of an absolute one
public string guessViewPathFrom(string $class, string $suffix='', bool $isPublic=false)
Guess the package path from a specified class.
Parameters
- string $class - Class to guess path from.
- string $suffix - An extra path to attach to the end
- bool $isPublic - Returns public path instead of an absolute one
public void handleError($exception)
Sets standard page variables in the case of a controller error.
Parameters
- $exception
public bool hasAssetsDefined()
Returns true if assets any have been added.
public boolean hasFatalError()
public boolean isBackendHintHidden(string $name)
Checks if a hint has been hidden by the user.
Parameters
- string $name - Unique key name
public boolean isClassExtendedWith(string $name)
Check if extendable class is extended with a behavior object
Parameters
- string $name - Fully qualified behavior name
public string makeAssets(string $type=NULL)
Outputs <link>
and <script>
tags to load assets previously added with addJs and addCss method calls
Parameters
- string $type - Return an asset collection of a given type (css, rss, js) or null for all.
public array|stdClass makeConfig(array $configFile=array(), array $requiredConfig=array())
Reads the contents of the supplied file and applies it to this object.
Parameters
- array $configFile
- array $requiredConfig
public stdClass makeConfigFromArray(array $configArray=array())
Makes a config object from an array, making the first level keys properties of a new object.
Parameters
- array $configArray - Config array.
public string makeFileContents(string $filePath, array $extraParams=array())
Includes a file path using output buffering. Ensures that vars are available.
Parameters
- string $filePath - Absolute path to the view file.
- array $extraParams - Parameters that should be available to the view.
public Backend\Classes\FormWidgetBase makeFormWidget(string $class, mixed $fieldConfig=array(), array $widgetConfig=array())
Makes a form widget object with the supplied form field and widget configuration.
Parameters
- string $class - Widget class name
- mixed $fieldConfig - A field name, an array of config or a FormField object.
- array $widgetConfig - An array of config.
public string makeHintPartial(string $name, string $partial=NULL, array $params=array())
Renders a hint partial, used for displaying informative information that can be hidden by the user. If you don't want to render a partial, you can supply content via the 'content' key of $params.
Parameters
- string $name - Unique key name
- string $partial - Reference to content (partial name)
- array $params - Extra parameters
public mixed makeLayout(string $name=NULL, array $params=array(), bool $throwException=true)
Render a layout.
Parameters
- string $name - Specifies the layout name. If this parameter is omitted, the $layout property will be used.
- array $params - Parameter variables to pass to the view.
- bool $throwException - Throw an exception if the layout is not found
public string makeLayoutPartial(string $partial, array $params=array())
Renders a layout partial
Parameters
- string $partial - The view to load.
- array $params - Parameter variables to pass to the view.
public mixed makePartial(string $partial, array $params=array(), bool $throwException=true)
Render a partial file contents located in the views folder.
Parameters
- string $partial - The view to load.
- array $params - Parameter variables to pass to the view.
- bool $throwException - Throw an exception if the partial is not found.
public mixed makeResponse(mixed $contents)
Prepares a response that considers overrides and custom responses.
Parameters
- mixed $contents
public string makeView(string $view)
Loads a view with the name specified. Applies layout if its name is provided by the parent object. The view file must be situated in the views directory, and has the extension "htm".
Parameters
- string $view - Specifies the view name, without extension. Eg: "index".
public string makeViewContent(string $contents, string $layout=NULL)
Renders supplied contents inside a layout.
Parameters
- string $contents - The inner contents as a string.
- string $layout - Specifies the layout name.
public Backend\Classes\WidgetBase makeWidget(string $class, array $widgetConfig=array())
Makes a widget object with the supplied configuration file.
Parameters
- string $class - Widget class name
- array $widgetConfig - An array of config.
public stdClass mergeConfig(mixed $configA, mixed $configB)
Merges two configuration sources, either prepared or not, and returns them as a single configuration object.
Parameters
- mixed $configA
- mixed $configB
public boolean methodExists(string $name)
Checks if a method exists, extension equivalent of method_exists()
Parameters
- string $name
public void onHideBackendHint()
Ajax handler to hide a backend hint, once hidden the partial will no longer display for the user.
public void pageAction()
Invokes the current controller action without rendering a view, used by AJAX handler that may rely on the logic inside the action.
public boolean propertyExists(string $name)
Checks if a property exists, extension equivalent of property_exists()
Parameters
- string $name
public mixed run(string $action=NULL, array $params=array())
Execute the controller action.
Parameters
- string $action - The action name.
- array $params - Routing parameters to pass to the action.
public $this setResponse(mixed $response)
Sets the response for the current page request cycle, this value takes priority over the standard response prepared by the controller.
Parameters
- mixed $response - Response object or string
public $this setResponseCookie(Symfony\Component\HttpFoundation\Cookie|mixed $cookie)
Add a cookie to the response.
Parameters
- Symfony\Component\HttpFoundation\Cookie|mixed $cookie
public $this setResponseHeader(string $key, array|string $values, bool $replace=true)
Set a header on the Response.
Parameters
- string $key
- array|string $values
- bool $replace
public $this setStatusCode(int $code)
Sets the status code for the current web response.
Parameters
- int $code - Status code
public self unbindEvent(string $event=NULL)
Destroys an event binding.
Parameters
- string $event - Event to destroy
Inherited public methods
- public Symfony\Component\HttpFoundation\Response callAction(string $method, array $parameters) - defined in Illuminate\Routing\Controller. Execute an action on the controller.
- public array getMiddleware() - defined in Illuminate\Routing\Controller. Get the middleware assigned to the controller.
- public Illuminate\Routing\ControllerMiddlewareOptions middleware(array|string|\Closure $middleware, array $options=array()) - defined in Illuminate\Routing\Controller. Register middleware on the controller.
Protected methods
protected void addAsset(string $type, string $path, array $attributes)
Adds the provided asset to the internal asset collections
Parameters
- string $type - The type of the asset: 'js' || 'css' || 'rss'
- string $path - The path to the asset
- array $attributes - The attributes for the asset
protected array emitterEventSortEvents(string $eventName)
Sort the listeners for a given event by priority.
Parameters
- string $eventName
protected void execAjaxHandlers()
This method is used internally. Invokes a controller event handler and loads the supplied partials.
protected void execPageAction(string $actionName, array $parameters)
This method is used internally. Invokes the controller action and loads the corresponding view.
Parameters
- string $actionName - Specifies a action name to execute.
- array $parameters - A list of the action parameters.
protected boolean extendableIsAccessible(mixed $class, string $propertyName)
Checks if a property is accessible, property equivalent of is_callable()
Parameters
- mixed $class
- string $propertyName
protected void extensionExtractMethods(string $extensionName, object $extensionObject)
Extracts the available methods from a behavior and adds it to the list of callable methods.
Parameters
- string $extensionName
- object $extensionObject
protected string getAssetEntryBuildPath(array $asset)
Internal helper, attaches a build code to an asset path
Parameters
- array $asset - Stored asset array
protected string getAssetScheme(string $asset)
Internal helper, get asset scheme
Parameters
- string $asset - Specifies a path (URL) to the asset.
protected void getLocalPath($relativePath)
Parameters
- $relativePath
protected void handleViewException(Exception $e, int $obLevel)
Handle a view exception.
Parameters
- Exception $e
- int $obLevel
protected Symfony\Component\HttpFoundation\Cookie makeXsrfCookie()
Adds anti-CSRF cookie. Adds a cookie with a token for CSRF checks to the response.
protected void removeDuplicates()
Removes duplicate assets from the entire collection.
protected boolean runAjaxHandler($handler)
Tries to find and run an AJAX handler in the page action. The method stops as soon as the handler is found.
Parameters
- $handler
protected mixed runAjaxHandlerForWidget($widget, $handler)
Specific code for executing an AJAX handler for a widget. This will append the widget view paths to the controller and merge the vars.
Parameters
- $widget
- $handler
protected bool verifyCsrfToken()
Checks the request data / headers for a valid CSRF token. Returns false if a valid token is not found. Override this method to disable the check.
protected bool verifyForceSecure()
Checks if the back-end should force a secure protocol (HTTPS) enabled by config.