Documentation

CRM_Core_Action
in package

The core concept of the system is an action performed on an object. Typically this will be a "data model" object as specified in the API specs. We attempt to keep the number and type of actions consistent and similar across all objects (thus providing both reuse and standards)

Tags
copyright

CiviCRM LLC https://civicrm.org/licensing

Table of Contents

Constants

ADD  = 1
Different possible actions are defined here.
ADVANCED  = 512
Different possible actions are defined here.
BASIC  = 256
Different possible actions are defined here.
BROWSE  = 16
Different possible actions are defined here.
CLOSE  = 262144
Different possible actions are defined here.
COPY  = 16384
Different possible actions are defined here.
DELETE  = 8
Different possible actions are defined here.
DETACH  = 65536
Different possible actions are defined here.
DISABLE  = 64
Different possible actions are defined here.
ENABLE  = 32
Different possible actions are defined here.
EXPORT  = 128
Different possible actions are defined here.
FOLLOWUP  = 2048
Different possible actions are defined here.
MAP  = 4096
Different possible actions are defined here.
MAX_ACTION  = 1048575
Different possible actions are defined here.
NONE  = 0
Different possible actions are defined here.
PREVIEW  = 1024
Different possible actions are defined here.
PROFILE  = 8192
Different possible actions are defined here.
RENEW  = 32768
Different possible actions are defined here.
REOPEN  = 524288
Different possible actions are defined here.
REVERT  = 131072
Different possible actions are defined here.
UPDATE  = 2
Different possible actions are defined here.
VIEW  = 4
Different possible actions are defined here.

Properties

$_names  : array<string|int, mixed>
Map the action names to the relevant constant. We perform bit manipulation operations so we can perform multiple actions on the same object if needed

Methods

description()  : string
Given an action mask, get the name which describes it, e.g. self::ADD returns 'add'.
filterLinks()  : array<string|int, mixed>|null
Given a set of links and a mask, return a filtered (by mask) array containing the final links with parsed values and calling hooks as appropriate.
formLink()  : string
Given a set of links and a mask, return the html action string for the links associated with the mask
getIcon()  : int|null
getLabel()  : string|null
getTitle()  : string|null
Builds a title based on action and entity title, e.g. "Update Contact"
getWeight()  : int|null
map()  : int
Given a string or an array of strings, determine the bitmask for this set of actions
mapItem()  : int
Given a string lookup the bitmask for the action name.
mask()  : int
Get the mask for a permission (view, edit or null)
replace()  : string
Given a string and an array of values, substitute the real values in the placeholder in the str in the CiviCRM format
resolve()  : int
Called by the request object to translate a string into a mask.
getInfo()  : array<string|int, mixed>

Constants

ADD

Different possible actions are defined here.

public int ADD = 1

ADVANCED

Different possible actions are defined here.

public int ADVANCED = 512

BASIC

Different possible actions are defined here.

public int BASIC = 256

BROWSE

Different possible actions are defined here.

public int BROWSE = 16

CLOSE

Different possible actions are defined here.

public int CLOSE = 262144

COPY

Different possible actions are defined here.

public int COPY = 16384

DELETE

Different possible actions are defined here.

public int DELETE = 8

DETACH

Different possible actions are defined here.

public int DETACH = 65536

DISABLE

Different possible actions are defined here.

public int DISABLE = 64

ENABLE

Different possible actions are defined here.

public int ENABLE = 32

EXPORT

Different possible actions are defined here.

public int EXPORT = 128

FOLLOWUP

Different possible actions are defined here.

public int FOLLOWUP = 2048

MAP

Different possible actions are defined here.

public int MAP = 4096

MAX_ACTION

Different possible actions are defined here.

public int MAX_ACTION = 1048575

NONE

Different possible actions are defined here.

public int NONE = 0

PREVIEW

Different possible actions are defined here.

public int PREVIEW = 1024

PROFILE

Different possible actions are defined here.

public int PROFILE = 8192

RENEW

Different possible actions are defined here.

public int RENEW = 32768

REOPEN

Different possible actions are defined here.

public int REOPEN = 524288

REVERT

Different possible actions are defined here.

public int REVERT = 131072

UPDATE

Different possible actions are defined here.

public int UPDATE = 2

VIEW

Different possible actions are defined here.

public int VIEW = 4

Properties

$_names

Map the action names to the relevant constant. We perform bit manipulation operations so we can perform multiple actions on the same object if needed

public static array<string|int, mixed> $_names = ['add' => self::ADD, 'update' => self::UPDATE, 'view' => self::VIEW, 'delete' => self::DELETE, 'browse' => self::BROWSE, 'enable' => self::ENABLE, 'disable' => self::DISABLE, 'export' => self::EXPORT, 'preview' => self::PREVIEW, 'map' => self::MAP, 'copy' => self::COPY, 'profile' => self::PROFILE, 'renew' => self::RENEW, 'detach' => self::DETACH, 'revert' => self::REVERT, 'close' => self::CLOSE, 'reopen' => self::REOPEN, 'advanced' => self::ADVANCED]

Methods

description()

Given an action mask, get the name which describes it, e.g. self::ADD returns 'add'.

public static description(int $mask) : string
Parameters
$mask : int
Return values
string

Given a set of links and a mask, return a filtered (by mask) array containing the final links with parsed values and calling hooks as appropriate.

public static filterLinks(array<string|int, mixed> $links, int $mask, array<string|int, mixed> $values[, string|null $op = NULL ][, string|null $objectName = NULL ][, int $objectId = NULL ]) : array<string|int, mixed>|null

Use this when passing a set of action links to the API or to the form without adding html formatting.

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

The set of link items.

$mask : int

The mask to be used. a null mask means all items.

$values : array<string|int, mixed>

The array of values for parameter substitution in the link items.

$op : string|null = NULL
$objectName : string|null = NULL
$objectId : int = NULL
Return values
array<string|int, mixed>|null

The array describing each link

Given a set of links and a mask, return the html action string for the links associated with the mask

public static formLink(array<string|int, mixed> $links, int|null $mask, array<string|int, mixed> $values[, string $extraULName = 'more' ][, bool $enclosedAllInSingleUL = FALSE ][, null $op = NULL ][, null $objectName = NULL ][, int $objectId = NULL ][, string $iconMode = 'text' ]) : string
Parameters
$links : array<string|int, mixed>

The set of link items.

$mask : int|null

The mask to be used. a null mask means all items.

$values : array<string|int, mixed>

The array of values for parameter substitution in the link items.

$extraULName : string = 'more'

Enclosed extra links in this UL.

$enclosedAllInSingleUL : bool = FALSE

Force to enclosed all links in single UL.

$op : null = NULL
$objectName : null = NULL
$objectId : int = NULL
$iconMode : string = 'text'
  • text: even if icon is set for a link, display the name
  • icon: display only the icon for each link if it's available, and don't tuck anything under "more >"
  • both: if icon is available, display it next to the name for each link
Return values
string

the html string

getIcon()

public static getIcon(int $mask) : int|null
Parameters
$mask : int
Return values
int|null

getLabel()

public static getLabel(int $mask) : string|null
Parameters
$mask : int
Return values
string|null

getTitle()

Builds a title based on action and entity title, e.g. "Update Contact"

public static getTitle(int $action, string $entityTitle) : string|null
Parameters
$action : int
$entityTitle : string
Return values
string|null

getWeight()

public static getWeight(int $mask) : int|null
Parameters
$mask : int
Return values
int|null

map()

Given a string or an array of strings, determine the bitmask for this set of actions

public static map(mixed $item) : int
Parameters
$item : mixed

Either a single string or an array of strings.

Return values
int

the action mask corresponding to the input args

mapItem()

Given a string lookup the bitmask for the action name.

public static mapItem(string $name) : int

e.g. "add" returns self::ADD.

Parameters
$name : string
Return values
int

mask()

Get the mask for a permission (view, edit or null)

public static mask(array<string|int, mixed> $permissions) : int
Parameters
$permissions : array<string|int, mixed>
Return values
int

The mask for the above permission

replace()

Given a string and an array of values, substitute the real values in the placeholder in the str in the CiviCRM format

public static & replace(string &$str, array<string|int, mixed> &$values) : string
Parameters
$str : string

The string to be replaced.

$values : array<string|int, mixed>

The array of values for parameter substitution in the str.

Return values
string

the substituted string

resolve()

Called by the request object to translate a string into a mask.

public static resolve(string $str) : int
Parameters
$str : string

The action to be resolved.

Return values
int

the action mask corresponding to the input string

getInfo()

private static getInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results