Documentation

ActionBase extends ExtensionBase
in package
implements Action Uses ConfigMaker, ViewMaker

Notification action base class

Tags
author

Alexey Bobkov, Samuel Georges

Interfaces, Classes and Traits

Action
This contract represents a notification action.

Table of Contents

$extendableStaticCalledClass  : string
$layout  : string
$suppressLayout  : bool
$vars  : array<string|int, mixed>
$configPath  : string
$extensionCallbacks  : array<string|int, mixed>
$extensionHidden  : mixed
$fieldConfig  : mixed
$host  : Model
$layoutPath  : string
$viewPath  : string|array<string|int, mixed>
__construct()  : mixed
actionDetails()  : mixed
Returns information about this action, including name and description.
addViewPath()  : void
Prepends a path on the available view path locations.
boot()  : array<string|int, mixed>
Boot method called when the condition class is first loaded with an existing model.
defineFormFields()  : mixed
Extra field configuration for the condition.
defineValidationRules()  : array<string|int, mixed>
Defines validation rules for the custom fields.
extend()  : mixed
extensionApplyInitCallbacks()  : mixed
extensionExtendCallback()  : void
Helper method for `::extend()` static method
extensionIsHiddenField()  : mixed
extensionIsHiddenMethod()  : mixed
findActions()  : array<string|int, mixed>
Spins over types registered in plugin base class with `registerNotificationRules`.
getActionDescription()  : mixed
getActionIcon()  : mixed
getActionName()  : mixed
getCalledExtensionClass()  : mixed
getConfigPath()  : string
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.
getFieldConfig()  : mixed
Returns the field configuration used by this model.
getText()  : string
Returns a action text summary when displaying to the user.
getTitle()  : string
Returns a action title for displaying in the action settings form.
getViewPath()  : string
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.
getViewPaths()  : array<string|int, mixed>
Returns the active view path locations.
guessConfigPath()  : string
Guess the package path for the called class.
guessConfigPathFrom()  : string
Guess the package path from a specified class.
guessViewPath()  : string
Guess the package path for the called class.
guessViewPathFrom()  : string
Guess the package path from a specified class.
hasFieldConfig()  : bool
Determines if this action uses form fields.
initConfigData()  : mixed
Initializes configuration data when the condition is first created.
makeConfig()  : array<string|int, mixed>|stdClass
Reads the contents of the supplied file and applies it to this object.
makeConfigFromArray()  : stdClass
Makes a config object from an array, making the first level keys properties of a new object.
makeFileContents()  : string
Includes a file path using output buffering.
makeLayout()  : mixed
Render a layout.
makeLayoutPartial()  : string
Renders a layout partial
makePartial()  : mixed
Render a partial file contents located in the views folder.
makeView()  : string
Loads a view with the name specified. Applies layout if its name is provided by the parent object.
makeViewContent()  : string
Renders supplied contents inside a layout.
mergeConfig()  : stdClass
Merges two configuration sources, either prepared or not, and returns them as a single configuration object.
triggerAction()  : void
Triggers this action.
extensionHideField()  : mixed
extensionHideMethod()  : mixed
handleViewException()  : void
Handle a view exception.

Properties

$extendableStaticCalledClass

public static string $extendableStaticCalledClass = null

The calling class when using a static method.

$layout

public string $layout

Layout to use for the view.

$suppressLayout

public bool $suppressLayout = false

Prevents the use of a layout.

$vars

public array<string|int, mixed> $vars = []

A list of variables to pass to the page.

$configPath

protected string $configPath

Specifies a path to the config directory.

$extensionCallbacks

protected static array<string|int, mixed> $extensionCallbacks = []

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

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

$extensionHidden

protected mixed $extensionHidden = ['fields' => [], 'methods' => ['extensionIsHiddenField', 'extensionIsHiddenMethod']]

$fieldConfig

protected mixed $fieldConfig

Extra field configuration for the condition.

$layoutPath

protected string $layoutPath

Specifies a path to the layout directory.

$viewPath

protected string|array<string|int, mixed> $viewPath

Specifies a path to the views directory.

Methods

__construct()

public __construct([mixed $host = null ]) : mixed
Parameters
$host : mixed = null
Return values
mixed

actionDetails()

Returns information about this action, including name and description.

public actionDetails() : mixed
Return values
mixed

addViewPath()

Prepends a path on the available view path locations.

public addViewPath(string|array<string|int, mixed> $path) : void
Parameters
$path : string|array<string|int, mixed>
Return values
void

boot()

Boot method called when the condition class is first loaded with an existing model.

public boot(mixed $host) : array<string|int, mixed>
Parameters
$host : mixed
Return values
array<string|int, mixed>

defineFormFields()

Extra field configuration for the condition.

public defineFormFields() : mixed
Return values
mixed

defineValidationRules()

Defines validation rules for the custom fields.

public defineValidationRules() : array<string|int, mixed>
Return values
array<string|int, mixed>

extend()

public static extend(callable $callback) : mixed
Parameters
$callback : callable
Return values
mixed

extensionApplyInitCallbacks()

public extensionApplyInitCallbacks() : mixed
Return values
mixed

extensionExtendCallback()

Helper method for `::extend()` static method

public static extensionExtendCallback(callable $callback) : void
Parameters
$callback : callable
Return values
void

extensionIsHiddenField()

public extensionIsHiddenField(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

extensionIsHiddenMethod()

public extensionIsHiddenMethod(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

findActions()

Spins over types registered in plugin base class with `registerNotificationRules`.

public static findActions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getActionDescription()

public getActionDescription() : mixed
Return values
mixed

getActionIcon()

public getActionIcon() : mixed
Return values
mixed

getActionName()

public getActionName() : mixed
Return values
mixed

getCalledExtensionClass()

public static getCalledExtensionClass() : mixed
Return values
mixed

getConfigPath()

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.

public getConfigPath(string $fileName[, mixed $configPath = null ]) : string
Parameters
$fileName : string

File to load.

$configPath : mixed = null

Explicitly define a config path.

Return values
string

Full path to the config file.

getFieldConfig()

Returns the field configuration used by this model.

public getFieldConfig() : mixed
Return values
mixed

getText()

Returns a action text summary when displaying to the user.

public getText() : string
Return values
string

getTitle()

Returns a action title for displaying in the action settings form.

public getTitle() : string
Return values
string

getViewPath()

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.

public getViewPath(string $fileName[, mixed $viewPath = null ]) : string
Parameters
$fileName : string

File to load.

$viewPath : mixed = null

Explicitly define a view path.

Return values
string

Full path to the view file.

getViewPaths()

Returns the active view path locations.

public getViewPaths() : array<string|int, mixed>
Return values
array<string|int, mixed>

guessConfigPath()

Guess the package path for the called class.

public guessConfigPath([string $suffix = '' ]) : string
Parameters
$suffix : string = ''

An extra path to attach to the end

Return values
string

guessConfigPathFrom()

Guess the package path from a specified class.

public guessConfigPathFrom(string $class[, string $suffix = '' ]) : string
Parameters
$class : string

Class to guess path from.

$suffix : string = ''

An extra path to attach to the end

Return values
string

guessViewPath()

Guess the package path for the called class.

public guessViewPath([string $suffix = '' ][, bool $isPublic = false ]) : string
Parameters
$suffix : string = ''

An extra path to attach to the end

$isPublic : bool = false

Returns public path instead of an absolute one

Return values
string

guessViewPathFrom()

Guess the package path from a specified class.

public guessViewPathFrom(string $class[, string $suffix = '' ][, bool $isPublic = false ]) : string
Parameters
$class : string

Class to guess path from.

$suffix : string = ''

An extra path to attach to the end

$isPublic : bool = false

Returns public path instead of an absolute one

Return values
string

hasFieldConfig()

Determines if this action uses form fields.

public hasFieldConfig() : bool
Return values
bool

initConfigData()

Initializes configuration data when the condition is first created.

public initConfigData(Model $host) : mixed
Parameters
$host : Model
Return values
mixed

makeConfig()

Reads the contents of the supplied file and applies it to this object.

public makeConfig([array<string|int, mixed> $configFile = [] ][, array<string|int, mixed> $requiredConfig = [] ]) : array<string|int, mixed>|stdClass
Parameters
$configFile : array<string|int, mixed> = []
$requiredConfig : array<string|int, mixed> = []
Return values
array<string|int, mixed>|stdClass

makeConfigFromArray()

Makes a config object from an array, making the first level keys properties of a new object.

public makeConfigFromArray([array<string|int, mixed> $configArray = [] ]) : stdClass
Parameters
$configArray : array<string|int, mixed> = []

Config array.

Return values
stdClass

The config object

makeFileContents()

Includes a file path using output buffering.

public makeFileContents(string $filePath[, array<string|int, mixed> $extraParams = [] ]) : string

Ensures that vars are available.

Parameters
$filePath : string

Absolute path to the view file.

$extraParams : array<string|int, mixed> = []

Parameters that should be available to the view.

Return values
string

makeLayout()

Render a layout.

public makeLayout([string $name = null ][, array<string|int, mixed> $params = [] ][, bool $throwException = true ]) : mixed
Parameters
$name : string = null

Specifies the layout name. If this parameter is omitted, the $layout property will be used.

$params : array<string|int, mixed> = []

Parameter variables to pass to the view.

$throwException : bool = true

Throw an exception if the layout is not found

Return values
mixed

The layout contents, or false.

makeLayoutPartial()

Renders a layout partial

public makeLayoutPartial(string $partial[, array<string|int, mixed> $params = [] ]) : string
Parameters
$partial : string

The view to load.

$params : array<string|int, mixed> = []

Parameter variables to pass to the view.

Return values
string

The layout partial contents

makePartial()

Render a partial file contents located in the views folder.

public makePartial(string $partial[, array<string|int, mixed> $params = [] ][, bool $throwException = true ]) : mixed
Parameters
$partial : string

The view to load.

$params : array<string|int, mixed> = []

Parameter variables to pass to the view.

$throwException : bool = true

Throw an exception if the partial is not found.

Return values
mixed

Partial contents or false if not throwing an exception.

makeView()

Loads a view with the name specified. Applies layout if its name is provided by the parent object.

public makeView(string $view) : string

The view file must be situated in the views directory, and has the extension "htm".

Parameters
$view : string

Specifies the view name, without extension. Eg: "index".

Return values
string

makeViewContent()

Renders supplied contents inside a layout.

public makeViewContent(string $contents[, string $layout = null ]) : string
Parameters
$contents : string

The inner contents as a string.

$layout : string = null

Specifies the layout name.

Return values
string

mergeConfig()

Merges two configuration sources, either prepared or not, and returns them as a single configuration object.

public mergeConfig(mixed $configA, mixed $configB) : stdClass
Parameters
$configA : mixed
$configB : mixed
Return values
stdClass

The config object

triggerAction()

Triggers this action.

public triggerAction(mixed $params) : void
Parameters
$params : mixed
Return values
void

extensionHideField()

protected extensionHideField(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

extensionHideMethod()

protected extensionHideMethod(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

handleViewException()

Handle a view exception.

protected handleViewException(Exception $e, int $obLevel) : void
Parameters
$e : Exception
$obLevel : int
Return values
void

Search results