CRM_Contact_StateMachine_Search
extends CRM_Core_StateMachine
in package
Core StateMachine.
Tags
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.
- $_task : string
- The task that the wizard is currently processing
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.
- 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
- Since this is a state machine for search and we want to come back to the same state we dont want to issue a reset of the state session when we are done processing a task
- taskName() : array<string|int, mixed>
- Determine the form name based on the action. This allows us to avoid using conditional state machine, much more efficient and simpler
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
$_task
The task that the wizard is currently processing
protected
string
$_task
Methods
__construct()
Class constructor.
public
__construct(object $controller[, const|int $action = CRM_Core_Action::NONE ]) : CRM_Core_StateMachine
Parameters
- $controller : object
- $action : const|int = CRM_Core_Action::NONE
Return values
CRM_Core_StateMachineaddSequentialPages()
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.
cancelAction()
public
cancelAction() : mixed
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
fini()
public
fini() : mixed
getAction()
Getter for action.
public
getAction() : int
Return values
intgetContent()
Getter for content.
public
& getContent() : string
Return values
stringgetDestination()
public
getDestination() : mixed
getName()
Getter for name.
public
getName() : string
Return values
stringgetPages()
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.
public
getTaskFormName() : string
Return values
stringperform()
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
objectreset()
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()
Since this is a state machine for search and we want to come back to the same state we dont want to issue a reset of the state session when we are done processing a task
public
shouldReset() : bool
Return values
booltaskName()
Determine the form name based on the action. This allows us to avoid using conditional state machine, much more efficient and simpler
public
taskName(CRM_Core_Controller $controller[, string $formName = 'Search' ]) : array<string|int, mixed>
Parameters
- $controller : CRM_Core_Controller
-
The controller object.
- $formName : string = 'Search'
Return values
array<string|int, mixed> —the name of the form that will handle the task