class CRM_Core_BAO_Block

Properties

static $requiredBlockFields Fields that are required for a valid block.

Methods

static array
getValues(string $blockName, array $params)

Given the list of params in the params array, fetch the object and store the values in the values array

static array
retrieveBlock(Object $block, string $blockName)

Given the list of params in the params array, fetch the object and store the values in the values array

static bool
dataExists(array $blockFields, array $params)

Check if the current block object has any valid data.

static bool
blockExists(string $blockName, array $params)

Check if the current block exits.

static array
getBlockIds(string $blockName, int $contactId = NULL, null $entityElements = NULL, bool $updateBlankLocInfo = FALSE)

Get all block ids for a contact.

static object
create(string $blockName, array $params, null $entity = NULL, int $contactId = NULL)

Takes an associative array and creates a block.

static 
blockDelete(string $blockName, int $params)

Delete block.

static 
handlePrimary(array $params, $class)

Handling for is_primary.

static 
sortPrimaryFirst(array $locations)

Sort location array so primary element is first.

static int
primaryComparison(array $location1, array $location2)

compare 2 locations to see which should go first based on is_primary (sort function for sortPrimaryFirst)

Details

at line 59
static array getValues(string $blockName, array $params)

Given the list of params in the params array, fetch the object and store the values in the values array

Parameters

string $blockName Name of the above object.
array $params Input parameters to find object.

Return Value

array Array of $block objects.

at line 105
static array retrieveBlock(Object $block, string $blockName)

Given the list of params in the params array, fetch the object and store the values in the values array

Parameters

Object $block Typically a Phone|Email|IM|OpenID object.
string $blockName Name of the above object.

Return Value

array Array of $block objects.

at line 136
static bool dataExists(array $blockFields, array $params)

Check if the current block object has any valid data.

Parameters

array $blockFields Array of fields that are of interest for this object.
array $params Associated array of submitted fields.

Return Value

bool true if the block has data, otherwise false

at line 156
static bool blockExists(string $blockName, array $params)

Check if the current block exits.

Parameters

string $blockName Bloack name.
array $params Associated array of submitted fields.

Return Value

bool true if the block exits, otherwise false

at line 180
static array getBlockIds(string $blockName, int $contactId = NULL, null $entityElements = NULL, bool $updateBlankLocInfo = FALSE)

Get all block ids for a contact.

Parameters

string $blockName Block name.
int $contactId Contact id.
null $entityElements
bool $updateBlankLocInfo

Return Value

array formatted array of block ids

at line 222
static object create(string $blockName, array $params, null $entity = NULL, int $contactId = NULL)

Takes an associative array and creates a block.

Parameters

string $blockName Block name.
array $params (reference ) an assoc array of name/value pairs.
null $entity
int $contactId

Return Value

object CRM_Core_BAO_Block object on success, null otherwise

at line 362
static blockDelete(string $blockName, int $params)

Delete block.

Parameters

string $blockName Block name.
int $params Associates array.

at line 401
static handlePrimary(array $params, $class)

Handling for is_primary.

$params is_primary could be # 1 - find other entries with is_primary = 1 & reset them to 0 # 0 - make sure at least one entry is set to 1 - if no other entry is 1 change to 1 - if one other entry exists change that to 1 - if more than one other entry exists change first one to 1

Parameters

array $params
$class

Exceptions

API_Exception

at line 471
static sortPrimaryFirst(array $locations)

Sort location array so primary element is first.

Parameters

array $locations

at line 482
static int primaryComparison(array $location1, array $location2)

compare 2 locations to see which should go first based on is_primary (sort function for sortPrimaryFirst)

Parameters

array $location1
array $location2

Return Value

int