class CRM_Core_CommunityMessages

Manage the download, validation, and rendering of community messages

Constants

DEFAULT_MESSAGES_URL

DEFAULT_PERMISSION

DEFAULT_RETRY

Properties

protected CRM_Utils_HttpClient $client
protected CRM_Utils_Cache_Interface $cache
protected false|string $messagesUrl Url to retrieve community messages from.

Methods

create()

Create default instance.

__construct(CRM_Utils_Cache_Interface $cache, CRM_Utils_HttpClient $client, string|false $messagesUrl = NULL)

Class constructor.

NULL|array
getDocument()

Get the messages document (either from the cache or by downloading).

NULL|array
fetchDocument()

Download document from URL and parse as JSON.

FALSE|string
getRenderedUrl()

Get the final, usable URL string (after interpolating any variables)

bool
isEnabled()

No description

NULL|array
pick()

Pick a message to display.

static string
evalMarkup(string $markup)

No description

bool
validateDocument(array $document)

Ensure that a document is well-formed

Details

at line 66
static CRM_Core_CommunityMessages create()

Create default instance.

at line 80
__construct(CRM_Utils_Cache_Interface $cache, CRM_Utils_HttpClient $client, string|false $messagesUrl = NULL)

Class constructor.

Parameters

CRM_Utils_Cache_Interface $cache
CRM_Utils_HttpClient $client
string|false $messagesUrl

at line 99
NULL|array getDocument()

Get the messages document (either from the cache or by downloading).

Return Value

NULL|array

at line 140
NULL|array fetchDocument()

Download document from URL and parse as JSON.

Return Value

NULL|array parsed JSON

at line 157
FALSE|string getRenderedUrl()

Get the final, usable URL string (after interpolating any variables)

Return Value

FALSE|string

at line 164
bool isEnabled()

Return Value

bool

at line 173
NULL|array pick()

Pick a message to display.

Return Value

NULL|array

at line 205
static string evalMarkup(string $markup)

Parameters

string $markup

Return Value

string

at line 231
bool validateDocument(array $document)

Ensure that a document is well-formed

Parameters

array $document

Return Value

bool