CRM_Core_Block
in package
Defines a simple implementation of a drupal block.
Blocks definitions and html are in a smarty template file.
Table of Contents
Constants
- ADD = 4
- The following blocks are supported.
- CREATE_NEW = 1
- The following blocks are supported.
- DASHBOARD = 3
- The following blocks are supported.
- EVENT = 6
- The following blocks are supported.
- FULLTEXT_SEARCH = 7
- The following blocks are supported.
- LANGSWITCH = 5
- The following blocks are supported.
- RECENTLY_VIEWED = 2
- The following blocks are supported.
Properties
- $_properties : array<string|int, mixed>
- Template file names for the above blocks.
Methods
- __construct() : mixed
- Class constructor.
- fetch() : array<string|int, mixed>
- Given an id and a template, fetch the contents
- getContent() : array<string|int, mixed>
- Given an id creates a subject/content array
- getInfo() : array<string|int, mixed>
- Creates the info block for drupal.
- getProperty() : string
- Returns the desired property from the $_properties array
- initProperties() : mixed
- Initialises the $_properties array
- properties() : array<string|int, mixed>
- Returns the whole $_properties array.
- setProperty() : mixed
- Sets the desired property in the $_properties array
- setShortcutValues() : array<string|int, mixed>
- setTemplateDashboardValues() : mixed
- Create the list of dashboard links.
- setTemplateEventValues() : mixed
- Create the event blocks for upcoming events.
- setTemplateMailValues() : mixed
- Create the list of mail urls for the application and format is as a block.
- setTemplateShortcutValues() : mixed
- Create the list of options to create New objects for the application and format is as a block.
- setTemplateValues() : mixed
- Set the post action values for the block.
Constants
ADD
The following blocks are supported.
public
int
ADD
= 4
CREATE_NEW
The following blocks are supported.
public
int
CREATE_NEW
= 1
DASHBOARD
The following blocks are supported.
public
int
DASHBOARD
= 3
EVENT
The following blocks are supported.
public
int
EVENT
= 6
FULLTEXT_SEARCH
The following blocks are supported.
public
int
FULLTEXT_SEARCH
= 7
LANGSWITCH
The following blocks are supported.
public
int
LANGSWITCH
= 5
RECENTLY_VIEWED
The following blocks are supported.
public
int
RECENTLY_VIEWED
= 2
Properties
$_properties
Template file names for the above blocks.
public
static array<string|int, mixed>
$_properties
= \NULL
Methods
__construct()
Class constructor.
public
__construct() : mixed
fetch()
Given an id and a template, fetch the contents
public
static fetch(int $id, string $fileName, array<string|int, mixed> $properties) : array<string|int, mixed>
Parameters
- $id : int
-
Id of the block.
- $fileName : string
-
Name of the template file.
- $properties : array<string|int, mixed>
-
Template variables.
Return values
array<string|int, mixed>getContent()
Given an id creates a subject/content array
public
static getContent(int $id) : array<string|int, mixed>
Parameters
- $id : int
-
Id of the block.
Return values
array<string|int, mixed>getInfo()
Creates the info block for drupal.
public
static getInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>getProperty()
Returns the desired property from the $_properties array
public
static getProperty(int $id, string $property) : string
Parameters
- $id : int
-
One of the class constants (ADD, SEARCH, etc.).
- $property : string
-
The desired property.
Return values
string —the value of the desired property
initProperties()
Initialises the $_properties array
public
static initProperties() : mixed
properties()
Returns the whole $_properties array.
public
static properties() : array<string|int, mixed>
Return values
array<string|int, mixed> —the $_properties array
setProperty()
Sets the desired property in the $_properties array
public
static setProperty(int $id, string $property, mixed $value) : mixed
Parameters
- $id : int
-
One of the class constants (ADD, SEARCH, etc.).
- $property : string
-
The desired property.
- $value : mixed
-
The value of the desired property.
setShortcutValues()
private
static setShortcutValues(array<string|int, mixed> $short) : array<string|int, mixed>
Parameters
- $short : array<string|int, mixed>
Return values
array<string|int, mixed>setTemplateDashboardValues()
Create the list of dashboard links.
private
static setTemplateDashboardValues() : mixed
setTemplateEventValues()
Create the event blocks for upcoming events.
private
static setTemplateEventValues() : mixed
setTemplateMailValues()
Create the list of mail urls for the application and format is as a block.
private
static setTemplateMailValues() : mixed
setTemplateShortcutValues()
Create the list of options to create New objects for the application and format is as a block.
private
static setTemplateShortcutValues() : mixed
setTemplateValues()
Set the post action values for the block.
private
static setTemplateValues(int $id) : mixed
php is lame and u cannot call functions from static initializers hence this hack
Parameters
- $id : int