CRM_Utils_System_Drupal8
class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase
Drupal specific stuff goes here.
Properties
bool | $is_drupal | Deprecated property to check if this is a drupal install. | from CRM_Utils_System_Base |
bool | $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 | from CRM_Utils_System_Base |
bool | $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 | from CRM_Utils_System_Base |
bool | $supports_UF_Logging | Does this CMS / UF support a CMS specific logging mechanism? | from CRM_Utils_System_DrupalBase |
bool | $supports_form_extensions | from CRM_Utils_System_Base |
Methods
No description
No description
No description
This function does nothing in Drupal 8. Changes to the base_url should be made in settings.php directly.
Drupal 8 has a different function to get current path, hence overriding the postURL function
No description
No description
No description
No description
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.
If we are using a theming system, invoke theme, else just print the content.
No description
Get the absolute path to the site's base url.
No description
Determine the location of the CMS root.
No description
No description
No description
No description
Determine the native ID of the CMS user.
No description
No description
No description
No description
No description
No description
Determine the default location for file storage.
Determine the location of the CiviCRM source tree.
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.
Set timezone in mysql so that timestamp fields show the correct time.
No description
No description
Get an array of user details for a contact, containing at minimum the user ID & name.
No description
Return a UFID (user account ID from the UserFramework / CMS system.
Return a unique identifier (usually an email address or username) from the UserFramework / CMS system.
No description
Append Drupal js to coreResourcesList.
No description
Check if a resource url is within the drupal directory and format appropriately.
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
Find any users/roles/security-principals with the given permission and replace it with one or more permissions.
Parse the name of the drupal site.
Check if username and email exists in the drupal db.
Load drupal bootstrap.
Details
in CRM_Utils_System_Base at line 53
initialize()
at line 189
appendBreadCrumb($breadcrumbs)
at line 199
resetBreadCrumb()
at line 206
addHTMLHead($header)
at line 320
mapConfigToSSL()
This function does nothing in Drupal 8. Changes to the base_url should be made in settings.php directly.
at line 628
string
postURL(string $action)
Drupal 8 has a different function to get current path, hence overriding the postURL function
at line 326
string
url(string $path = '', string $query = '', bool $absolute = FALSE, string $fragment = NULL, bool $frontend = FALSE, bool $forceBackend = FALSE)
at line 365
array|bool
authenticate(string $name, string $password, bool $loadCMSBootstrap = FALSE, string $realPath = NULL)
in CRM_Utils_System_DrupalBase at line 218
setMessage(string $message)
at line 378
bool
loadUser($username)
at line 412
permissionDenied()
at line 420
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.
in CRM_Utils_System_DrupalBase at line 399
updateCategories()
in CRM_Utils_System_DrupalBase at line 408
string|null
getUFLocale()
in CRM_Utils_System_Base at line 230
string|null
theme(string $content, bool $print = FALSE, bool $maintenance = FALSE)
If we are using a theming system, invoke theme, else just print the content.
at line 533
string
getDefaultBlockLocation()
in CRM_Utils_System_Base at line 295
bool|mixed|string
getAbsoluteBaseURL()
Get the absolute path to the site's base url.
in CRM_Utils_System_Base at line 317
bool
getRelativeBaseURL()
Get the relative path to the sites base url.
in CRM_Utils_System_DrupalBase at line 392
string
getVersion()
in CRM_Utils_System_DrupalBase at line 333
string
languageNegotiationURL(string $url, bool $addLanguagePart = TRUE, bool $removeLanguagePart = FALSE)
at line 485
string|null
cmsRootPath(string $path = NULL)
Determine the location of the CMS root.
at line 42
int|bool
createUser(array $params, string $mail)
at line 109
updateCMSName(int $ufID, string $email)
at line 517
bool
isUserLoggedIn()
at line 171
string
getLoginURL(string $destination = '')
in CRM_Utils_System_DrupalBase at line 472
string|NULL
getLoginDestination(CRM_Core_Form $form)
at line 403
getUfId(string $username)
Determine the native ID of the CMS user.
in CRM_Utils_System_DrupalBase at line 436
bool
setUFLocale(string $civicrm_language)
in CRM_Utils_System_Base at line 453
setUserSession(array $data)
Set a init session with user object.
at line 540
flush()
in CRM_Utils_System_DrupalBase at line 278
clearResourceCache()
at line 213
bool
addScriptUrl(string $url, string $region)
at line 240
bool
addScript(string $code, string $region)
at line 261
bool
addStyleUrl(string $url, string $region)
at line 279
bool
addStyle(string $code, string $region)
at line 179
setTitle(string $title, string|null $pageTitle = NULL)
in CRM_Utils_System_DrupalBase at line 64
array
getDefaultSiteSettings(string $dir)
in CRM_Utils_System_Base at line 582
array
getDefaultFileStorage()
Determine the default location for file storage.
FIXME: 1. This was pulled out from a bigger function. It should be split into even smaller pieces and marked abstract. 2. This would be easier to compute by a calling a CMS API, but for whatever reason Civi gets it from config data.
in CRM_Utils_System_Base at line 631
array
getCiviSourceStorage()
Determine the location of the CiviCRM source tree.
FIXME: 1. This was pulled out from a bigger function. It should be split into even smaller pieces and marked abstract. 2. This would be easier to compute by a calling a CMS API, but for whatever reason we take the hard way.
in CRM_Utils_System_DrupalBase at line 465
userLoginFinalize(array $params = array())
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.
in CRM_Utils_System_Base at line 694
setMySQLTimeZone()
Set timezone in mysql so that timestamp fields show the correct time.
in CRM_Utils_System_Base at line 708
string|false|null
getTimeZoneOffset()
Get timezone from CMS.
in CRM_Utils_System_Base at line 738
string
getTimeZoneString()
Get timezone as a string.
at line 568
mixed
getUniqueIdentifierFromUserObject(object $user)
at line 575
null|int
getUserIDFromUserObject(object $user)
in CRM_Utils_System_DrupalBase at line 527
array
getUser(int $contactID)
Get an array of user details for a contact, containing at minimum the user ID & name.
at line 524
int|null
getLoggedInUfID()
in CRM_Utils_System_DrupalBase at line 232
string|null
getLoggedInUniqueIdentifier()
in CRM_Utils_System_Base at line 824
int
getBestUFID(object $user = NULL)
Return a UFID (user account ID from the UserFramework / CMS system.
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.
in CRM_Utils_System_Base at line 844
string
getBestUFUniqueIdentifier(object $user = NULL)
Return a unique identifier (usually an email address or username) from the UserFramework / CMS system.
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.
at line 552
array
getModules()
in CRM_Utils_System_DrupalBase at line 247
string|null
getUserRecordUrl(int $contactID)
in CRM_Utils_System_DrupalBase at line 262
bool
checkPermissionAddUser()
in CRM_Utils_System_Base at line 887
outputError(string $content)
Output code from error function.
in CRM_Utils_System_DrupalBase at line 269
logger(string $message)
in CRM_Utils_System_DrupalBase at line 287
appendCoreResources(array $list)
Append Drupal js to coreResourcesList.
in CRM_Utils_System_Base at line 911
setHttpHeader(string $name, string $value)
at line 582
array
synchronizeUsers()
in CRM_Utils_System_DrupalBase at line 50
__construct()
at line 304
bool
formatResourceUrl($url)
Check if a resource url is within the drupal directory and format appropriately.
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.
in CRM_Utils_System_DrupalBase at line 135
string
appendCoreDirectoryToResourceBase(string $url)
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
in CRM_Utils_System_DrupalBase at line 320
void
replacePermission(string $oldPerm, array $newPerms)
Find any users/roles/security-principals with the given permission and replace it with one or more permissions.
in CRM_Utils_System_DrupalBase at line 544
object
getUserObject($userID)
Load the user object.
Note this function still works in drupal 6, 7 & 8 but is deprecated in Drupal 8.
in CRM_Utils_System_DrupalBase at line 555
null|string
parseDrupalSiteName(string $civicrm_root)
Parse the name of the drupal site.
at line 130
static
checkUserNameEmailExists(array $params, array $errors, string $emailName = 'email')
Check if username and email exists in the drupal db.
at line 438
bool
loadBootStrap(array $params = array(), bool $loadUser = TRUE, bool $throwError = TRUE, bool|string $realPath = NULL)
Load drupal bootstrap.