CRM_Utils_System_Drupal8
extends CRM_Utils_System_DrupalBase
in package
Drupal specific stuff goes here.
Table of Contents
Properties
- $is_drupal : bool
- Deprecated property to check if this is a drupal install.
- $is_joomla : bool
- Deprecated property to check if this is a joomla install. The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
- $is_wordpress : bool
- deprecated property to check if this is a wordpress install. The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
- $supports_form_extensions : bool
- $supports_UF_Logging : bool
- Does this CMS / UF support a CMS specific logging mechanism?
Methods
- __construct() : mixed
- addHTMLHead() : mixed
- Append a string to the head of the html file.
- addScript() : bool
- Add an inline script.
- addScriptUrl() : bool
- Add a script file.
- addStyle() : bool
- Add an inline style.
- addStyleUrl() : bool
- Add a css file.
- allowSynchronizeUsers() : bool
- Whether to allow access to CMS user sync action
- alterAssetUrl() : mixed
- Modify dynamic assets.
- appendBreadCrumb() : mixed
- Append an additional breadcrumb tag to the existing breadcrumb.
- appendCoreDirectoryToResourceBase() : string
- In instance where civicrm folder has a drupal folder & a civicrm core folder @ the same level append the civicrm folder name to the url See CRM-13737 for discussion of how this allows implementers to alter the folder structure
- appendCoreResources() : mixed
- Append Drupal8 js to coreResourcesList.
- authenticate() : array<string|int, mixed>|bool
- Authenticate the user against the CMS db.
- canSetBasePage() : bool
- Can set base page for CiviCRM By default, CiviCRM will generate front-facing pages using the home page. This allows a different template for CiviCRM pages.
- checkCleanurls() : mixed
- checkPermissionAddUser() : bool
- Is the current user permitted to add a user.
- checkUserNameEmailExists() : mixed
- Check if username and email exists in the CMS.
- clearResourceCache() : mixed
- Flush css/js caches.
- cmsRootPath() : null|string
- Determine the location of the CMS root.
- createUser() : int|bool
- Create a user in the CMS.
- currentPath() : string|null
- Path of the current page e.g. 'civicrm/contact/view'
- flush() : mixed
- Reset any system caches that may be required for proper CiviCRM integration.
- formatResourceUrl() : bool
- Check if a resource url is within the drupal directory and format appropriately.
- getAbsoluteBaseURL() : bool|mixed|string
- Get the absolute path to the site's base url.
- getBestUFID() : int
- Return a UFID (user account ID from the UserFramework / CMS system.
- getBestUFUniqueIdentifier() : string
- Return a unique identifier (usually an email address or username) from the UserFramework / CMS system.
- getCiviSourceStorage() : array<string|int, mixed>
- Determine the location of the CiviCRM source tree.
- getCMSPermissionsUrlParams() : array<string|int, mixed>
- Return the CMS-specific url for its permissions page
- getContactDetailsFromUser() : array<string|int, mixed>
- Get Contact details from User The contact parameters here will be used to create a Contact record to match the user record.
- getContentTemplate() : string
- Returns the Smarty template path to the main template that renders the content.
- getCRMDatabasePrefix() : string
- Get the CRM database as a 'prefix'.
- getCurrentLanguage() : string
- Function to return current language of Drupal8
- getDefaultBlockLocation() : string
- getDefaultFileStorage() : array<string|int, mixed>
- Determine the default location for file storage.
- getDefaultSiteSettings() : array<string|int, mixed>
- Return default Site Settings.
- getEmailFieldName() : string
- Get email field name from form values
- getLoggedInUfID() : int|null
- Get currently logged in user uf id.
- getLoggedInUniqueIdentifier() : string|null
- Get currently logged in user unique identifier - this tends to be the email address or user name.
- getLoginDestination() : string|null
- Get the login destination string.
- getLoginURL() : string
- Get user login URL for hosting CMS (method declared in each CMS system class)
- getModules() : array<string|int, mixed>
- List modules installed in the CMS, including enabled and disabled ones.
- getNotifyUrl() : string
- Return the Notification URL for Payments.
- getRelativeBaseURL() : string|false
- Get the relative path to the sites base url.
- getRoleNames() : array<string|int, mixed>|null
- Get role names
- getSessionId() : mixed
- This exists because of https://www.drupal.org/node/3006306 where they changed so that they don't start sessions for anonymous, but we want that.
- getTimeZoneOffset() : string|false|null
- Get timezone offset from CMS
- getTimeZoneString() : string
- Get timezone from CMS as a string.
- getUfGroupTypes() : array<string|int, mixed>
- Return the CMS-specific UF Group Types for profiles.
- getUfId() : int|null
- Determine the native ID of the CMS user.
- getUFLocale() : string|null
- Get the locale set in the CMS.
- getUniqueIdentifierFromUserObject() : mixed
- Get Unique Identifier from UserFramework system (CMS).
- getUser() : array<string|int, mixed>
- Get an array of user details for a contact, containing at minimum the user ID & name.
- getUserIDFromUserObject() : null|int
- Get User ID from UserFramework system (CMS).
- getUserObject() : object
- Load the user object.
- getUserRecordUrl() : string|null
- Get Url to view user record.
- getVersion() : string
- Get CMS Version.
- hasUsersTable() : bool
- Has CMS users table
- initialize() : mixed
- invalidateRouteCache() : mixed
- Helper function to rebuild the Drupal 8 or 9 dynamic routing cache.
- ipAddress() : string
- Get the client's IP address.
- isFrontEndPage() : bool
- Is a front end page being accessed.
- isPasswordUserGenerated() : bool
- Check if user can create passwords or is initially assigned a system-generated one.
- isUserLoggedIn() : bool
- Check if user is logged in to the CMS.
- isUserRegistrationPermitted() : bool
- Check if user registration is permitted.
- languageNegotiationURL() : string
- Format the url as per language Negotiation.
- loadBootStrap() : bool
- Load drupal bootstrap.
- loadUser() : bool
- Load user into session.
- logger() : mixed
- Log error to CMS.
- logout() : mixed
- In previous versions, this function was the controller for logging out. In Drupal 8, we rewrite the route to hand off logout to the standard Drupal logout controller. This function should therefore never be called.
- mailingWorkflowIsEnabled() : bool
- Check if mailing workflow is enabled
- mapConfigToSSL() : mixed
- This function does nothing in Drupal 8. Changes to the base_url should be made in settings.php directly.
- modifyStandaloneProfile() : string
- Modify standalone profile
- onCiviExit() : mixed
- Commit the session before exiting.
- outputError() : mixed
- Output code from error function.
- parseDrupalSiteNameFromRoot() : null|string
- Parse the name of the drupal site.
- parseUrl() : array<string|int, string>
- Helper function to extract path, query and route name from Civicrm URLs.
- permissionDenied() : mixed
- Immediately stop script execution and display a 401 "Access Denied" page.
- postContainerBoot() : void
- Hook for further system boot once the main CiviCRM Container is up (only used in Standalone currently)
- postURL() : string
- Drupal 8 has a different function to get current path, hence overriding the postURL function
- prePostRedirect() : mixed
- Perform any necessary actions prior to redirecting via POST.
- replacePermission() : void
- Find any users/roles/security-principals with the given permission and replace it with one or more permissions.
- resetBreadCrumb() : mixed
- Reset an additional breadcrumb tag to the existing breadcrumb.
- sendResponse() : mixed
- Send an HTTP Response base on PSR HTTP RespnseInterface response.
- sessionStart() : mixed
- Start a new session.
- setHttpHeader() : mixed
- setMessage() : mixed
- Set a message in the CMS to display to a user.
- setMySQLTimeZone() : mixed
- Set MySQL timezone so that timestamp fields show the correct time.
- setPhpTimeZone() : mixed
- Set PHP timezone
- setTimeZone() : mixed
- Set system timezone (both PHP + MySQL)
- setTitle() : mixed
- Sets the title of the page.
- setUFLocale() : bool
- Set the localisation from the user framework.
- setUserSession() : mixed
- Set a init session with user object.
- showPasswordFieldWhenAdminCreatesUser() : mixed
- Should the admin be able to set the password when creating a user or does the CMS want it a different way.
- suppressProfileFormErrors() : bool
- Suppress profile form errors
- synchronizeUsers() : array<string|int, mixed>
- Create CRM contacts for all existing CMS users
- synchronizeUsersIfAllowed() : array<string|int, mixed>
- Run CMS user sync if allowed, otherwise just returns empty array
- theme() : string|null
- If we are using a theming system, invoke theme, else just print the content.
- updateCategories() : mixed
- Clear CMS caches related to the user registration/profile forms.
- updateCMSName() : mixed
- Update a user's email address in the CMS.
- url() : string
- Generate an internal CiviCRM URL (copied from DRUPAL/includes/common.inc#url)
- userLoginFinalize() : mixed
- Perform any post login activities required by the UF - e.g. for drupal: records a watchdog message about the new session, saves the login timestamp, calls hook_user op 'login' and generates a new session.
- verifyPassword() : mixed
- Verify password
- viewsExists() : bool
- Determine if the Views module exists.
- viewsIntegration() : string
- CiviCRM Table prefixes To display for CMS integration.
- parseDrupalSiteNameFromRequest() : null|string
- Determine if Drupal multi-site applies to the current request -- and, specifically, determine the name of the multisite folder.
Properties
$is_drupal
Deprecated property to check if this is a drupal install.
TRUE, if the CMS is Drupal.
public
bool
$is_drupal
= \FALSE
The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
$is_joomla
Deprecated property to check if this is a joomla install. The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
TRUE, if the CMS is Joomla!.
public
bool
$is_joomla
= \FALSE
$is_wordpress
deprecated property to check if this is a wordpress install. The correct method is to have functions on the UF classes for all UF specific functions and leave the codebase oblivious to the type of CMS
TRUE, if the CMS is WordPress.
public
bool
$is_wordpress
= \FALSE
$supports_form_extensions
public
bool
$supports_form_extensions
= \FALSE
TRUE, if the CMS allows CMS forms to be extended by hooks.
$supports_UF_Logging
Does this CMS / UF support a CMS specific logging mechanism?
public
bool
$supports_UF_Logging
= \TRUE
Tags
Methods
__construct()
public
__construct() : mixed
addHTMLHead()
Append a string to the head of the html file.
public
addHTMLHead(mixed $header) : mixed
Parameters
- $header : mixed
Tags
addScript()
Add an inline script.
public
addScript(string $code, string $region) : bool
Note: This function is not to be called directly
Parameters
- $code : string
-
javascript code
- $region : string
-
location within the document: 'html-header', 'page-header', 'page-footer'.
Tags
Return values
bool —TRUE if we support this operation in this CMS, FALSE otherwise
addScriptUrl()
Add a script file.
public
addScriptUrl(string $url, string $region) : bool
Note: This function is not to be called directly
Parameters
- $url : string
-
absolute path to file
- $region : string
-
location within the document: 'html-header', 'page-header', 'page-footer'.
Tags
Return values
bool —TRUE if we support this operation in this CMS, FALSE otherwise
addStyle()
Add an inline style.
public
addStyle(mixed $code, mixed $region) : bool
Parameters
- $code : mixed
-
css code
- $region : mixed
-
location within the document: 'html-header', 'page-header', 'page-footer'.
Tags
Return values
bool —TRUE if we support this operation in this CMS, FALSE otherwise
addStyleUrl()
Add a css file.
public
addStyleUrl(mixed $url, mixed $region) : bool
Parameters
- $url : mixed
-
absolute path to file
- $region : mixed
-
location within the document: 'html-header', 'page-header', 'page-footer'.
Tags
Return values
bool —TRUE if we support this operation in this CMS, FALSE otherwise
allowSynchronizeUsers()
Whether to allow access to CMS user sync action
public
allowSynchronizeUsers() : bool
Return values
boolalterAssetUrl()
Modify dynamic assets.
public
alterAssetUrl(GenericHookEvent $e) : mixed
Parameters
- $e : GenericHookEvent
appendBreadCrumb()
Append an additional breadcrumb tag to the existing breadcrumb.
public
appendBreadCrumb(mixed $breadcrumbs) : mixed
Parameters
- $breadcrumbs : mixed
Tags
appendCoreDirectoryToResourceBase()
In instance where civicrm folder has a drupal folder & a civicrm core folder @ the same level append the civicrm folder name to the url See CRM-13737 for discussion of how this allows implementers to alter the folder structure
public
appendCoreDirectoryToResourceBase(string $url) : string
Parameters
- $url : string
-
Potential resource url based on standard folder assumptions.
Tags
Return values
string —with civicrm-core directory appended if not standard civi dir
appendCoreResources()
Append Drupal8 js to coreResourcesList.
public
appendCoreResources(GenericHookEvent $e) : mixed
Parameters
- $e : GenericHookEvent
authenticate()
Authenticate the user against the CMS db.
public
authenticate(mixed $name, mixed $password[, mixed $loadCMSBootstrap = FALSE ][, mixed $realPath = NULL ]) : array<string|int, mixed>|bool
Parameters
- $name : mixed
-
The user name.
- $password : mixed
-
The password for the above user.
- $loadCMSBootstrap : mixed = FALSE
-
Load cms bootstrap?.
- $realPath : mixed = NULL
-
Filename of script
Tags
Return values
array<string|int, mixed>|bool —[contactID, ufID, unique string] else false if no auth
canSetBasePage()
Can set base page for CiviCRM By default, CiviCRM will generate front-facing pages using the home page. This allows a different template for CiviCRM pages.
public
canSetBasePage() : bool
Return values
boolcheckCleanurls()
public
checkCleanurls() : mixed
checkPermissionAddUser()
Is the current user permitted to add a user.
public
checkPermissionAddUser() : bool
Tags
Return values
boolcheckUserNameEmailExists()
Check if username and email exists in the CMS.
public
checkUserNameEmailExists(mixed &$params, mixed &$errors[, mixed $emailName = 'email' ]) : mixed
Parameters
- $params : mixed
-
Array of name and mail values.
- $errors : mixed
-
Array of errors.
- $emailName : mixed = 'email'
-
Field label for the 'email'.
Tags
clearResourceCache()
Flush css/js caches.
public
clearResourceCache() : mixed
Tags
cmsRootPath()
Determine the location of the CMS root.
public
cmsRootPath([string $path = NULL ]) : null|string
Parameters
- $path : string = NULL
Return values
null|stringcreateUser()
Create a user in the CMS.
public
createUser(mixed &$params, mixed $mailParam) : int|bool
Parameters
- $params : mixed
- $mailParam : mixed
-
Name of the $param which contains the email address. Because. Right. OK. That's what it is.
Tags
Return values
int|bool —uid if user exists, false otherwise
currentPath()
Path of the current page e.g. 'civicrm/contact/view'
public
static currentPath() : string|null
Return values
string|null —the current menu path
flush()
Reset any system caches that may be required for proper CiviCRM integration.
public
flush() : mixed
Tags
formatResourceUrl()
Check if a resource url is within the drupal directory and format appropriately.
public
formatResourceUrl(string &$url) : bool
This seems to be a legacy function. We assume all resources are within the drupal directory and always return TRUE. As well, we clean up the $url.
FIXME: This is not a legacy function and the above is not a safe assumption. External urls are allowed by CRM_Core_Resources and this needs to return the correct value.
Parameters
- $url : string
Return values
boolgetAbsoluteBaseURL()
Get the absolute path to the site's base url.
public
getAbsoluteBaseURL() : bool|mixed|string
Return values
bool|mixed|stringgetBestUFID()
Return a UFID (user account ID from the UserFramework / CMS system.
public
getBestUFID([object $user = NULL ]) : int
ID is based on the user object passed, defaulting to the logged in user if not passed.
Note that ambiguous situation occurs in CRM_Core_BAO_UFMatch::synchronize - a cleaner approach would seem to be resolving the user id before calling the function.
Note there is already a function getUFId which takes $username as a param - we could add $user as a second param to it but it seems messy - just overloading it because the name is taken.
Parameters
- $user : object = NULL
Return values
int —User ID of UF System
getBestUFUniqueIdentifier()
Return a unique identifier (usually an email address or username) from the UserFramework / CMS system.
public
getBestUFUniqueIdentifier([object $user = NULL ]) : string
This is based on the user object passed, defaulting to the logged in user if not passed.
Note that ambiguous situation occurs in CRM_Core_BAO_UFMatch::synchronize - a cleaner approach would seem to be resolving the unique identifier before calling the function.
Parameters
- $user : object = NULL
Return values
string —unique identifier from the UF System
getCiviSourceStorage()
Determine the location of the CiviCRM source tree.
public
getCiviSourceStorage() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —- url: string. ex: "http://example.com/sites/all/modules/civicrm"
- path: string. ex: "/var/www/sites/all/modules/civicrm"
getCMSPermissionsUrlParams()
Return the CMS-specific url for its permissions page
public
getCMSPermissionsUrlParams() : array<string|int, mixed>
Return values
array<string|int, mixed>getContactDetailsFromUser()
Get Contact details from User The contact parameters here will be used to create a Contact record to match the user record.
public
getContactDetailsFromUser(mixed $uf_match) : array<string|int, mixed>
Parameters
- $uf_match : mixed
-
Array of user object, unique ID.
Tags
Return values
array<string|int, mixed> —Array of contact parameters.
getContentTemplate()
Returns the Smarty template path to the main template that renders the content.
public
static getContentTemplate([mixed $print = 0 ]) : string
In CMS contexts, this goes inside their theme, but Standalone needs to render the full HTML page.
Parameters
- $print : mixed = 0
Return values
stringgetCRMDatabasePrefix()
Get the CRM database as a 'prefix'.
public
getCRMDatabasePrefix() : string
This returns a string that can be prepended to a query to include a CRM table.
However, this string should contain backticks, or not, in accordance with the CMS's drupal views expectations, if any.
Return values
stringgetCurrentLanguage()
Function to return current language of Drupal8
public
getCurrentLanguage() : string
Return values
stringgetDefaultBlockLocation()
public
getDefaultBlockLocation() : string
Tags
Return values
stringgetDefaultFileStorage()
Determine the default location for file storage.
public
getDefaultFileStorage() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —- url: string. ex: "http://example.com/sites/foo.com/files/civicrm"
- path: string. ex: "/var/www/sites/foo.com/files/civicrm"
getDefaultSiteSettings()
Return default Site Settings.
public
getDefaultSiteSettings(mixed $dir) : array<string|int, mixed>
Parameters
- $dir : mixed
Tags
Return values
array<string|int, mixed> —- $url, (Joomla - non admin url)
- $siteName,
- $siteRoot
getEmailFieldName()
Get email field name from form values
public
getEmailFieldName(CRM_Core_Form $form, array<string|int, mixed> $fields) : string
Parameters
- $form : CRM_Core_Form
- $fields : array<string|int, mixed>
Tags
Return values
stringgetLoggedInUfID()
Get currently logged in user uf id.
public
getLoggedInUfID() : int|null
Tags
Return values
int|null —logged in user uf id.
getLoggedInUniqueIdentifier()
Get currently logged in user unique identifier - this tends to be the email address or user name.
public
getLoggedInUniqueIdentifier() : string|null
Tags
Return values
string|null —logged in user unique identifier
getLoginDestination()
Get the login destination string.
public
getLoginDestination(mixed &$form) : string|null
Parameters
- $form : mixed
-
Form object representing the 'current' form - to which the user will be returned.
Tags
Return values
string|null —destination value for URL
getLoginURL()
Get user login URL for hosting CMS (method declared in each CMS system class)
public
getLoginURL([mixed $destination = '' ]) : string
Parameters
- $destination : mixed = ''
-
If present, add destination to querystring (works for Drupal and WordPress only).
Tags
Return values
string —loginURL for the current CMS
getModules()
List modules installed in the CMS, including enabled and disabled ones.
public
getModules() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —[CRM_Core_Module]
getNotifyUrl()
Return the Notification URL for Payments.
public
getNotifyUrl([string $path = NULL ][, string $query = NULL ][, bool $absolute = FALSE ][, string $fragment = NULL ][, bool $frontend = FALSE ][, bool $forceBackend = FALSE ]) : string
The default is to pass the params through to url()
. However the WordPress
CMS class overrides this method because Notification URLs must always target
the Base Page to avoid IPN failures when Forms are embedded in pages that
require authentication.
Parameters
- $path : string = NULL
-
The path being linked to, such as "civicrm/add".
- $query : string = NULL
-
A query string to append to the link.
- $absolute : bool = FALSE
-
Whether to force the output to be an absolute link (beginning with http). Useful for links that will be displayed outside the site, such as in an RSS feed.
- $fragment : string = NULL
-
A fragment identifier (named anchor) to append to the link.
- $frontend : bool = FALSE
-
This link should be to the CMS front end (applies to WP & Joomla).
- $forceBackend : bool = FALSE
-
This link should be to the CMS back end (applies to WP & Joomla).
Return values
string —The Notification URL.
getRelativeBaseURL()
Get the relative path to the sites base url.
public
getRelativeBaseURL() : string|false
Return values
string|falsegetRoleNames()
Get role names
public
getRoleNames() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetSessionId()
This exists because of https://www.drupal.org/node/3006306 where they changed so that they don't start sessions for anonymous, but we want that.
public
getSessionId() : mixed
Tags
getTimeZoneOffset()
Get timezone offset from CMS
public
getTimeZoneOffset() : string|false|null
Return values
string|false|nullgetTimeZoneString()
Get timezone from CMS as a string.
public
getTimeZoneString() : string
Tags
Return values
string —Timezone string e.g. 'America/Los_Angeles'
getUfGroupTypes()
Return the CMS-specific UF Group Types for profiles.
public
getUfGroupTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>getUfId()
Determine the native ID of the CMS user.
public
getUfId(string $username) : int|null
Parameters
- $username : string
Return values
int|nullgetUFLocale()
Get the locale set in the CMS.
public
getUFLocale() : string|null
Tags
Return values
string|null —Locale or null for none
getUniqueIdentifierFromUserObject()
Get Unique Identifier from UserFramework system (CMS).
public
getUniqueIdentifierFromUserObject(mixed $user) : mixed
Parameters
- $user : mixed
-
Object as described by the User Framework.
Tags
Return values
mixed —Unique identifier from the user Framework system
getUser()
Get an array of user details for a contact, containing at minimum the user ID & name.
public
getUser(mixed $contactID) : array<string|int, mixed>
Parameters
- $contactID : mixed
Tags
Return values
array<string|int, mixed> —CMS user details including
- id
- name (ie the system user name.
getUserIDFromUserObject()
Get User ID from UserFramework system (CMS).
public
getUserIDFromUserObject(mixed $user) : null|int
Parameters
- $user : mixed
-
Object as described by the User Framework.
Tags
Return values
null|intgetUserObject()
Load the user object.
public
getUserObject(int $userID) : object
Parameters
- $userID : int
Return values
objectgetUserRecordUrl()
Get Url to view user record.
public
getUserRecordUrl(mixed $contactID) : string|null
Parameters
- $contactID : mixed
-
Contact ID.
Tags
Return values
string|nullgetVersion()
Get CMS Version.
public
getVersion() : string
Return values
stringhasUsersTable()
Has CMS users table
public
hasUsersTable() : bool
Tags
Return values
boolinitialize()
public
initialize() : mixed
invalidateRouteCache()
Helper function to rebuild the Drupal 8 or 9 dynamic routing cache.
public
invalidateRouteCache() : mixed
We need to do this after enabling extensions that add routes and it's worth doing when we reset Civi paths.
ipAddress()
Get the client's IP address.
public
ipAddress() : string
Tags
Return values
string —IP address
isFrontEndPage()
Is a front end page being accessed.
public
isFrontEndPage() : bool
Generally this would be a contribution form or other public page as opposed to a backoffice page (like contact edit).
See https://github.com/civicrm/civicrm-drupal/pull/546/files
Return values
boolisPasswordUserGenerated()
Check if user can create passwords or is initially assigned a system-generated one.
public
isPasswordUserGenerated() : bool
Tags
Return values
boolisUserLoggedIn()
Check if user is logged in to the CMS.
public
isUserLoggedIn() : bool
Tags
Return values
boolisUserRegistrationPermitted()
Check if user registration is permitted.
public
isUserRegistrationPermitted() : bool
Tags
Return values
boollanguageNegotiationURL()
Format the url as per language Negotiation.
public
languageNegotiationURL(mixed $url[, mixed $addLanguagePart = TRUE ][, mixed $removeLanguagePart = FALSE ]) : string
Parameters
- $url : mixed
- $addLanguagePart : mixed = TRUE
- $removeLanguagePart : mixed = FALSE
Tags
Return values
string —Formatted url.
loadBootStrap()
Load drupal bootstrap.
public
loadBootStrap([array<string|int, mixed> $params = [] ][, bool $loadUser = TRUE ][, bool $throwError = TRUE ][, bool|string $realPath = NULL ]) : bool
Parameters
- $params : array<string|int, mixed> = []
-
Either uid, or name & pass.
- $loadUser : bool = TRUE
-
Boolean Require CMS user load.
- $throwError : bool = TRUE
-
If true, print error on failure and exit.
- $realPath : bool|string = NULL
-
path to script
Tags
Return values
boolloadUser()
Load user into session.
public
loadUser(mixed $username) : bool
Parameters
- $username : mixed
Tags
Return values
boollogger()
Log error to CMS.
public
logger(mixed $message[, mixed $priority = NULL ]) : mixed
Parameters
- $message : mixed
- $priority : mixed = NULL
Tags
logout()
In previous versions, this function was the controller for logging out. In Drupal 8, we rewrite the route to hand off logout to the standard Drupal logout controller. This function should therefore never be called.
public
logout() : mixed
mailingWorkflowIsEnabled()
Check if mailing workflow is enabled
public
mailingWorkflowIsEnabled() : bool
Tags
Return values
boolmapConfigToSSL()
This function does nothing in Drupal 8. Changes to the base_url should be made in settings.php directly.
public
mapConfigToSSL() : mixed
modifyStandaloneProfile()
Modify standalone profile
public
modifyStandaloneProfile(mixed $profile, mixed $params) : string
Parameters
- $profile : mixed
- $params : mixed
Tags
Return values
stringonCiviExit()
Commit the session before exiting.
public
onCiviExit() : mixed
Similar to drupal_exit().
outputError()
Output code from error function.
public
outputError(string $content) : mixed
Parameters
- $content : string
parseDrupalSiteNameFromRoot()
Parse the name of the drupal site.
public
parseDrupalSiteNameFromRoot(string $civicrm_root) : null|string
Parameters
- $civicrm_root : string
Return values
null|stringparseUrl()
Helper function to extract path, query and route name from Civicrm URLs.
public
parseUrl(string $url) : array<string|int, string>
For example, 'civicrm/contact/view?reset=1&cid=66' will be returned as:
array(
'path' => 'civicrm/contact/view',
'route' => 'civicrm.civicrm_contact_view',
'query' => array('reset' => '1', 'cid' => '66'),
);
Parameters
- $url : string
-
The url to parse.
Return values
array<string|int, string> —The parsed url parts, containing 'path', 'route' and 'query'.
permissionDenied()
Immediately stop script execution and display a 401 "Access Denied" page.
public
permissionDenied() : mixed
Tags
postContainerBoot()
Hook for further system boot once the main CiviCRM Container is up (only used in Standalone currently)
public
postContainerBoot() : void
postURL()
Drupal 8 has a different function to get current path, hence overriding the postURL function
public
postURL(string $action) : string
Parameters
- $action : string
Return values
stringprePostRedirect()
Perform any necessary actions prior to redirecting via POST.
public
prePostRedirect() : mixed
replacePermission()
Find any users/roles/security-principals with the given permission and replace it with one or more permissions.
public
replacePermission(string $oldPerm, array<string|int, mixed> $newPerms) : void
Parameters
- $oldPerm : string
- $newPerms : array<string|int, mixed>
-
Array, strings.
resetBreadCrumb()
Reset an additional breadcrumb tag to the existing breadcrumb.
public
resetBreadCrumb() : mixed
Tags
sendResponse()
Send an HTTP Response base on PSR HTTP RespnseInterface response.
public
sendResponse(ResponseInterface $response) : mixed
Parameters
- $response : ResponseInterface
sessionStart()
Start a new session.
public
sessionStart() : mixed
setHttpHeader()
public
setHttpHeader(string $name, string $value) : mixed
Parameters
- $name : string
- $value : string
setMessage()
Set a message in the CMS to display to a user.
public
setMessage(mixed $message) : mixed
Parameters
- $message : mixed
-
The message to set.
Tags
setMySQLTimeZone()
Set MySQL timezone so that timestamp fields show the correct time.
public
setMySQLTimeZone([string|null $timeZone = NULL ]) : mixed
Parameters
- $timeZone : string|null = NULL
-
Timezone string - if none provided will be fetched from system
setPhpTimeZone()
Set PHP timezone
public
setPhpTimeZone([string|null $timeZone = NULL ]) : mixed
Parameters
- $timeZone : string|null = NULL
-
Timezone string - default value will be fetched using getTimeZoneString if not provided or falsey
setTimeZone()
Set system timezone (both PHP + MySQL)
public
setTimeZone([string|null $timeZone = NULL ]) : mixed
Parameters
- $timeZone : string|null = NULL
setTitle()
Sets the title of the page.
public
setTitle(mixed $title[, mixed $pageTitle = NULL ]) : mixed
Parameters
- $title : mixed
-
Title to set in html header
- $pageTitle : mixed = NULL
-
Title to set in html body (if different)
Tags
setUFLocale()
Set the localisation from the user framework.
public
setUFLocale(mixed $civicrm_language) : bool
Parameters
- $civicrm_language : mixed
Tags
Return values
boolsetUserSession()
Set a init session with user object.
public
setUserSession(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
-
Array with user specific data
showPasswordFieldWhenAdminCreatesUser()
Should the admin be able to set the password when creating a user or does the CMS want it a different way.
public
showPasswordFieldWhenAdminCreatesUser() : mixed
suppressProfileFormErrors()
Suppress profile form errors
public
suppressProfileFormErrors() : bool
Tags
Return values
boolsynchronizeUsers()
Create CRM contacts for all existing CMS users
public
synchronizeUsers() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>synchronizeUsersIfAllowed()
Run CMS user sync if allowed, otherwise just returns empty array
public
synchronizeUsersIfAllowed() : array<string|int, mixed>
Return values
array<string|int, mixed>theme()
If we are using a theming system, invoke theme, else just print the content.
public
theme(mixed &$content[, mixed $print = FALSE ][, mixed $maintenance = FALSE ]) : string|null
Parameters
- $content : mixed
-
The content that will be themed.
- $print : mixed = FALSE
-
Are we displaying to the screen or bypassing theming?.
- $maintenance : mixed = FALSE
-
For maintenance mode.
Tags
Return values
string|null —NULL, If $print is FALSE, and some other criteria match up. The themed string, otherwise.
updateCategories()
Clear CMS caches related to the user registration/profile forms.
public
updateCategories() : mixed
Tags
updateCMSName()
Update a user's email address in the CMS.
public
updateCMSName(mixed $ufID, mixed $email) : mixed
Parameters
- $ufID : mixed
-
User ID in CMS.
- $email : mixed
-
Primary contact email address.
Tags
url()
Generate an internal CiviCRM URL (copied from DRUPAL/includes/common.inc#url)
public
url([mixed $path = '' ][, mixed $query = '' ][, mixed $absolute = FALSE ][, mixed $fragment = NULL ][, mixed $frontend = FALSE ][, mixed $forceBackend = FALSE ]) : string
Parameters
- $path : mixed = ''
-
The path being linked to, such as "civicrm/add".
- $query : mixed = ''
-
A query string to append to the link.
- $absolute : mixed = FALSE
-
Whether to force the output to be an absolute link (beginning with http). Useful for links that will be displayed outside the site, such as in an RSS feed.
- $fragment : mixed = NULL
-
A fragment identifier (named anchor) to append to the link.
- $frontend : mixed = FALSE
-
This link should be to the CMS front end (applies to WP & Joomla).
- $forceBackend : mixed = FALSE
-
This link should be to the CMS back end (applies to WP & Joomla).
Tags
Return values
stringuserLoginFinalize()
Perform any post login activities required by the UF - e.g. for drupal: records a watchdog message about the new session, saves the login timestamp, calls hook_user op 'login' and generates a new session.
public
userLoginFinalize([array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $params : array<string|int, mixed> = []
-
FIXME: Document values accepted/required by $params
verifyPassword()
Verify password
public
verifyPassword(array<string|int, mixed> $params, array<string|int, mixed> &$errors) : mixed
Parameters
- $params : array<string|int, mixed>
-
Array of name, mail and password values.
- $errors : array<string|int, mixed>
-
Array of errors.
viewsExists()
Determine if the Views module exists.
public
viewsExists() : bool
Return values
boolviewsIntegration()
CiviCRM Table prefixes To display for CMS integration.
public
viewsIntegration() : string
Tags
Return values
stringparseDrupalSiteNameFromRequest()
Determine if Drupal multi-site applies to the current request -- and, specifically, determine the name of the multisite folder.
private
parseDrupalSiteNameFromRequest([string $flagFile = '' ]) : null|string
Parameters
- $flagFile : string = ''
-
Check if $flagFile exists inside the site dir.
Return values
null|string —string, e.g. bar.example.com
if using multisite.
NULL if using the default site.