BackendController

This is the master controller for all back-end pages.

 class Backend\Classes\BackendController
extends Illuminate\Routing\Controller

All requests that are prefixed with the backend URI pattern are sent here, then the next URI segments are analysed and the request is routed to the relevant back-end controller.

For example, a request with the URL /backend/acme/blog/posts will look for the Posts controller inside the Acme.Blog plugin.

Extends

Traits

Trait Description
ExtendableTrait

This extension trait is used when access to the underlying base class is not available, such as classes that belong to the foundation framework (Laravel). It is currently used by the Controller and Model classes.

Properties

public static $action : string

Allows early access to page action.

public $implement : array

Behaviors implemented by this controller.

public static $params : array

Allows early access to page parameters.

protected $cmsHandling : bool

Flag to indicate that the CMS module is handling the current request

protected $requestedController : Backend\Classes\Controller

Stores the requested controller so that the constructor is only run once

inherited protected static $extendableCallbacks : array

Inherited from ExtendableTrait

Used to extend the constructor of an extendable class. Eg:

Class::extend(function($obj) { })

inherited protected static $extendableClassLoader : ClassLoader | null

Inherited from ExtendableTrait

Class loader instance.

inherited protected static $extendableStaticMethods : array

Inherited from ExtendableTrait

Collection of static methods used by behaviors.

inherited protected $extensionData : array

Inherited from ExtendableTrait

Class reflection information, including behaviors.

Methods

public __call ($name, $params)

Parameters
Property Description
$name
mixed
$params
mixed
Returns
mixed

public static __callStatic ($name, $params)

Parameters
Property Description
$name
mixed
$params
mixed
Returns
mixed

public __construct ()

Instantiate a new BackendController instance.

Returns
mixed

public callAction ($method, $parameters)

Parameters
Property Description
$method
mixed
$parameters
mixed
Returns
mixed

public run (string $url = null) : string

Finds and serves the requested backend controller.

If the controller cannot be found, returns the Cms page with the URL /404. If the /404 page doesn't exist, returns the system 404 page.

Parameters
Property Description
$url
string

Specifies the requested page URL. If the parameter is omitted, the current URL used.

Returns
string

Returns the processed page content.

protected findController (string $controller, string $action, string $inPath) : ControllerBase

This method is used internally.

Finds a backend controller with a callable action method.

Parameters
Property Description
$controller
string

Specifies a method name to execute.

$action
string

Specifies a method name to execute.

$inPath
string

Base path for class file location.

Returns
ControllerBase

Returns the backend controller object

protected getRequestedController (string $url) : array | null

Determines the controller and action to load in the backend via a provided URL.

If a suitable controller is found, this will return an array with the controller class name as a string, the action to call as a string and an array of parameters. If a suitable controller and action cannot be found, this method will return null.

Parameters
Property Description
$url
string

A URL to determine the requested controller and action for

Returns
array | null

A suitable controller, action and parameters in an array if found, otherwise null.

protected static methodExcludedByOptions (string $method, array $options) : bool

Determine if the given options exclude a particular method.

Parameters
Property Description
$method
string
$options
array
Returns
bool

protected parseAction (string $actionName) : string

Process the action name, since dashes are not supported in PHP methods.

Parameters
Property Description
$actionName
string
Returns
string

protected passToCmsController (string $url) : Response

Pass unhandled URLs to the CMS Controller, if it exists

Parameters
Property Description
$url
string
Returns
Response

inherited public addDynamicMethod (string $dynamicName, callable $method, string $extension = null)

Inherited from ExtendableTrait

Programmatically adds a method to the extendable class

Parameters
Property Description
$dynamicName
string
$method
callable
$extension
string
Returns
mixed

inherited public addDynamicProperty (string $dynamicName, mixed $value = null) : void

Inherited from ExtendableTrait

Programmatically adds a property to the extendable class

Parameters
Property Description
$dynamicName
string

The name of the property to add

$value
mixed

The value of the property

Returns
void

inherited public asExtension (string $shortName) : mixed

Inherited from ExtendableTrait

Short hand for getClassExtension() method, except takes the short extension name, example:

$this->asExtension('FormController')

Parameters
Property Description
$shortName
string
Returns
mixed

inherited public static clearExtendedClasses () : void

Inherited from ExtendableTrait

Clear the list of extended classes so they will be re-extended.

Returns
void

inherited public extendClassWith (string $extensionName) : void

Inherited from ExtendableTrait

Dynamically extend a class with a specified behavior

Parameters
Property Description
$extensionName
string
Returns
void

inherited public extendableCall (string $name, array $params = null) : mixed

Inherited from ExtendableTrait

Magic method for __call().

Callback priority is as follows:

  • "Dynamic Methods" added locally to the object via addDynamicMethod($name, $callable)
  • Methods available on Behaviors that have been implemented by the object
  • Pass it to the parent's __call() method if it defines one
Parameters
Property Description
$name
string
$params
array
Returns
mixed

inherited public static extendableCallStatic (string $name, array $params = null) : mixed

Inherited from ExtendableTrait

Magic method for __callStatic()

Parameters
Property Description
$name
string
$params
array
Returns
mixed

inherited public extendableConstruct ()

Inherited from ExtendableTrait

This method should be called as part of the constructor.

Returns
mixed

inherited public static extendableExtendCallback (callable $callback, boolean $scoped = false, $outerScope = null) : void

Inherited from ExtendableTrait

Helper method for ::extend() static method.

Parameters
Property Description
$callback
callable
$scoped
boolean
$outerScope
mixed
Returns
void

inherited public extendableGet (string $name) : mixed | null

Inherited from ExtendableTrait

Magic method for __get()

Parameters
Property Description
$name
string
Returns
mixed | null

inherited public extendableSet (string $name, mixed $value) : void

Inherited from ExtendableTrait

Magic method for __set()

Parameters
Property Description
$name
string
$value
mixed
Returns
void

inherited public getClassExtension (string $name) : mixed

Inherited from ExtendableTrait

Returns a behavior object from an extendable class, example:

$this->getClassExtension('Backend.Behaviors.FormController')

Parameters
Property Description
$name
string

Fully qualified behavior name

Returns
mixed

inherited public getClassMethods () : array

Inherited from ExtendableTrait

Get a list of class methods, extension equivalent of get_class_methods()

Returns
array

inherited public getDynamicProperties () : array

Inherited from ExtendableTrait

Returns all dynamic properties and their values

Returns
array

['property' => 'value']

inherited public isClassExtendedWith (string $name) : bool

Inherited from ExtendableTrait

Check if extendable class is extended with a behavior object

Parameters
Property Description
$name
string

Fully qualified behavior name

Returns
bool

inherited public methodExists (string $name) : bool

Inherited from ExtendableTrait

Checks if a method exists, extension equivalent of method_exists()

Parameters
Property Description
$name
string
Returns
bool

inherited public propertyExists (string $name) : bool

Inherited from ExtendableTrait

Checks if a property exists, extension equivalent of property_exists()

Parameters
Property Description
$name
string
Returns
bool

inherited protected extendableIsAccessible (mixed $class, string $propertyName) : bool

Inherited from ExtendableTrait

Checks if a property is accessible, property equivalent of is_callable()

Parameters
Property Description
$class
mixed
$propertyName
string
Returns
bool

inherited protected extensionCallMethod (ReflectionClass $class, string $method, array $params)

Inherited from ExtendableTrait

Calls a method through reflection.

Parameters
Property Description
$class
ReflectionClass
$method
string
$params
array
Returns
mixed

inherited protected extensionExtractMethods (string $extensionName, object $extensionObject) : void

Inherited from ExtendableTrait

Extracts the available methods from a behavior and adds it to the list of callable methods.

Parameters
Property Description
$extensionName
string
$extensionObject
object
Returns
void

inherited protected extensionGetClassLoader () : Winter\Storm\Support\ClassLoader | null

Inherited from ExtendableTrait

Gets the class loader

Returns
Winter\Storm\Support\ClassLoader | null

inherited protected extensionGetParentClass ($instance = null) : ReflectionClass | false

Inherited from ExtendableTrait

Gets the parent class using reflection.

The parent class must either not be the Extendable class, or must not be using the ExtendableTrait trait, in order to prevent infinite loops.

Parameters
Property Description
$instance
mixed
Returns
ReflectionClass | false

inherited protected extensionMethodExists (ReflectionClass $class, string $methodName) : bool

Inherited from ExtendableTrait

Determines if the given class reflection contains the given method.

Parameters
Property Description
$class
ReflectionClass
$methodName
string
Returns
bool

inherited protected extensionNormalizeClassName (string $name) : string

Inherited from ExtendableTrait

Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes

Parameters
Property Description
$name
string
Returns
string
Copyright © 2024 Winter CMS