Documentation

CRM_Group_StateMachine extends CRM_Core_StateMachine
in package

Core StateMachine.

Tags
copyright

CiviCRM LLC https://civicrm.org/licensing

Table of Contents

Properties

$_action  : int
The mode that the state machine is operating in.
$_controller  : object
The controller of this state machine.
$_name  : string
The display name for this machine.
$_pageNames  : array<string|int, mixed>
The names of the pages.
$_pages  : array<string|int, mixed>
The list of pages that belong to this state machine. Note that a state and a form have a 1 <-> 1 relationship. so u can always derive one from the other
$_states  : array<string|int, mixed>
The list of states that belong to this state machine.

Methods

__construct()  : CRM_Core_StateMachine
Class constructor.
addSequentialPages()  : mixed
Add sequential pages.
addState()  : mixed
Helper function to add a State to the state machine.
cancelAction()  : mixed
find()  : object
Given a name find the corresponding state.
fini()  : mixed
getAction()  : int
Getter for action.
getContent()  : string
Getter for content.
getDestination()  : mixed
getName()  : string
Getter for name.
getPages()  : array<string|int, mixed>
Return the list of form objects.
getSkipRedirection()  : mixed
getState()  : CRM_Core_State
Return the state object corresponding to the name.
getStates()  : array<string|int, mixed>
Return the list of state objects.
getTaskFormName()  : string
Return the form name of the task. This is
perform()  : object
Do a state transition jump.
reset()  : mixed
Reset the state machine.
setContent()  : mixed
Setter for content.
setName()  : mixed
Setter for name.
shouldReset()  : bool
Should the controller reset the session In some cases, specifically search we want to remember state across various actions and want to go back to the beginning from the final state, but retain the same session values

Properties

$_action

The mode that the state machine is operating in.

protected int $_action = \NULL

$_controller

The controller of this state machine.

protected object $_controller

$_name

The display name for this machine.

protected string $_name = \NULL

$_pageNames

The names of the pages.

protected array<string|int, mixed> $_pageNames

$_pages

The list of pages that belong to this state machine. Note that a state and a form have a 1 <-> 1 relationship. so u can always derive one from the other

protected array<string|int, mixed> $_pages

$_states

The list of states that belong to this state machine.

protected array<string|int, mixed> $_states

Methods

addSequentialPages()

Add sequential pages.

public addSequentialPages(array<string|int, mixed> &$pages) : mixed

Meta level function to create a simple wizard for a state machine that is completely sequential.

Parameters
$pages : array<string|int, mixed>

(reference ) the array of page objects.

addState()

Helper function to add a State to the state machine.

public addState(string $name, int $type, object $prev, object $next) : mixed
Parameters
$name : string

The internal name.

$type : int

The type of state (START|FINISH|SIMPLE).

$prev : object

The previous page if any.

$next : object

The next page if any.

find()

Given a name find the corresponding state.

public find(string $name) : object
Parameters
$name : string

The state name.

Return values
object

the state object

getAction()

Getter for action.

public getAction() : int
Return values
int

getContent()

Getter for content.

public & getContent() : string
Return values
string

getName()

Getter for name.

public getName() : string
Return values
string

getPages()

Return the list of form objects.

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

array of pages in the state machine

getSkipRedirection()

public getSkipRedirection() : mixed

getState()

Return the state object corresponding to the name.

public & getState(string $name) : CRM_Core_State
Parameters
$name : string

Name of page.

Return values
CRM_Core_State

state object matching the name

getStates()

Return the list of state objects.

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

array of states in the state machine

getTaskFormName()

Return the form name of the task. This is

public getTaskFormName() : string
Return values
string

perform()

Do a state transition jump.

public perform(CRM_Core_Form &$page, string $actionName[, string $type = 'Next' ]) : object

Currently only supported types are Next and Back. The other actions (Cancel, Done, Submit etc) do not need the state machine to figure out where to go

Parameters
$page : CRM_Core_Form

The current form-page.

$actionName : string

Current action name, as one Action object can serve multiple actions.

$type : string = 'Next'

The type of transition being requested (Next or Back).

Return values
object

reset()

Reset the state machine.

public reset() : mixed

setContent()

Setter for content.

public setContent(string &$content) : mixed
Parameters
$content : string

The content generated by this state machine.

setName()

Setter for name.

public setName(string $name) : mixed
Parameters
$name : string

shouldReset()

Should the controller reset the session In some cases, specifically search we want to remember state across various actions and want to go back to the beginning from the final state, but retain the same session values

public shouldReset() : bool
Return values
bool

        
On this page

Search results