projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #14322 from AlainBenbassat/5.14
[civicrm-core.git]
/
CRM
/
Utils
/
System
/
Drupal8.php
diff --git
a/CRM/Utils/System/Drupal8.php
b/CRM/Utils/System/Drupal8.php
index b535b0a841bff2481cff3f5fde9f4d7296435dda..e280a40ba76f7db806c9150250eb0b9ea299cbd4 100644
(file)
--- a/
CRM/Utils/System/Drupal8.php
+++ b/
CRM/Utils/System/Drupal8.php
@@
-3,7
+3,7
@@
+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-201
8
|
+ | Copyright CiviCRM LLC (c) 2004-201
9
|
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
@@
-28,7
+28,7
@@
/**
*
* @package CRM
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-201
8
+ * @copyright CiviCRM LLC (c) 2004-201
9
*/
/**
*/
/**
@@
-184,8
+184,8
@@
class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
* @inheritDoc
*/
public function getLoginURL($destination = '') {
* @inheritDoc
*/
public function getLoginURL($destination = '') {
- $query = $destination ?
array('destination' => $destination) : array()
;
- return \Drupal::url('user.page',
array(), array('query' => $query)
);
+ $query = $destination ?
['destination' => $destination] : []
;
+ return \Drupal::url('user.page',
[], ['query' => $query]
);
}
/**
}
/**
@@
-229,13
+229,13
@@
class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
if ($region != 'html-header') {
return FALSE;
}
if ($region != 'html-header') {
return FALSE;
}
- $css =
array(
+ $css =
[
'#tag' => 'link',
'#tag' => 'link',
- '#attributes' =>
array(
+ '#attributes' =>
[
'href' => $url,
'rel' => 'stylesheet',
'href' => $url,
'rel' => 'stylesheet',
-
)
,
-
)
;
+
]
,
+
]
;
\Drupal::service('civicrm.page_state')->addCSS($css);
return TRUE;
}
\Drupal::service('civicrm.page_state')->addCSS($css);
return TRUE;
}
@@
-247,10
+247,10
@@
class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
if ($region != 'html-header') {
return FALSE;
}
if ($region != 'html-header') {
return FALSE;
}
- $css =
array(
+ $css =
[
'#tag' => 'style',
'#value' => $code,
'#tag' => 'style',
'#value' => $code,
-
)
;
+
]
;
\Drupal::service('civicrm.page_state')->addCSS($css);
return TRUE;
}
\Drupal::service('civicrm.page_state')->addCSS($css);
return TRUE;
}
@@
-304,11
+304,11
@@
class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
// Not all links that CiviCRM generates are Drupal routes, so we use the weaker ::fromUri method.
try {
// Not all links that CiviCRM generates are Drupal routes, so we use the weaker ::fromUri method.
try {
- $url = \Drupal\Core\Url::fromUri("base:{$url['path']}",
array(
+ $url = \Drupal\Core\Url::fromUri("base:{$url['path']}",
[
'query' => $url['query'],
'fragment' => $fragment,
'absolute' => $absolute,
'query' => $url['query'],
'fragment' => $fragment,
'absolute' => $absolute,
-
)
)->toString();
+
]
)->toString();
}
catch (Exception $e) {
// @Todo: log to watchdog
}
catch (Exception $e) {
// @Todo: log to watchdog
@@
-331,13
+331,13
@@
class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
*/
public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
$system = new CRM_Utils_System_Drupal8();
*/
public function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
$system = new CRM_Utils_System_Drupal8();
- $system->loadBootStrap(
array()
, FALSE);
+ $system->loadBootStrap(
[]
, FALSE);
$uid = \Drupal::service('user.auth')->authenticate($name, $password);
if ($uid) {
if ($this->loadUser($name)) {
$contact_id = CRM_Core_BAO_UFMatch::getContactId($uid);
$uid = \Drupal::service('user.auth')->authenticate($name, $password);
if ($uid) {
if ($this->loadUser($name)) {
$contact_id = CRM_Core_BAO_UFMatch::getContactId($uid);
- return
array($contact_id, $uid, mt_rand())
;
+ return
[$contact_id, $uid, mt_rand()]
;
}
}
}
}
@@
-407,7
+407,7
@@
class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
* @return bool
* @Todo Handle setting cleanurls configuration for CiviCRM?
*/
* @return bool
* @Todo Handle setting cleanurls configuration for CiviCRM?
*/
- public function loadBootStrap($params =
array()
, $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
+ public function loadBootStrap($params =
[]
, $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
static $run_once = FALSE;
if ($run_once) {
return TRUE;
static $run_once = FALSE;
if ($run_once) {
return TRUE;
@@
-427,7
+427,7
@@
class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
$autoloader = ComposerAutoloaderInitDrupal8::getLoader();
}
// @Todo: do we need to handle case where $_SERVER has no HTTP_HOST key, ie. when run via cli?
$autoloader = ComposerAutoloaderInitDrupal8::getLoader();
}
// @Todo: do we need to handle case where $_SERVER has no HTTP_HOST key, ie. when run via cli?
- $request = new \Symfony\Component\HttpFoundation\Request(
array(), array(), array(), array(), array()
, $_SERVER);
+ $request = new \Symfony\Component\HttpFoundation\Request(
[], [], [], [], []
, $_SERVER);
// Create a kernel and boot it.
\Drupal\Core\DrupalKernel::createFromRequest($request, $autoloader, 'prod')->prepareLegacyRequest($request);
// Create a kernel and boot it.
\Drupal\Core\DrupalKernel::createFromRequest($request, $autoloader, 'prod')->prepareLegacyRequest($request);
@@
-557,7
+557,7
@@
class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
* @inheritDoc
*/
public function getModules() {
* @inheritDoc
*/
public function getModules() {
- $modules =
array()
;
+ $modules =
[]
;
$module_data = system_rebuild_module_data();
foreach ($module_data as $module_name => $extension) {
$module_data = system_rebuild_module_data();
foreach ($module_data as $module_name => $extension) {
@@
-602,7
+602,7
@@
class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
set_time_limit(300);
}
set_time_limit(300);
}
- $users =
array()
;
+ $users =
[]
;
$users = \Drupal::entityTypeManager()->getStorage('user')->loadByProperties();
$uf = $config->userFramework;
$users = \Drupal::entityTypeManager()->getStorage('user')->loadByProperties();
$uf = $config->userFramework;
@@
-627,11
+627,11
@@
class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
}
}
}
}
- return
array(
+ return
[
'contactCount' => $contactCount,
'contactMatching' => $contactMatching,
'contactCreated' => $contactCreated,
'contactCount' => $contactCount,
'contactMatching' => $contactMatching,
'contactCreated' => $contactCreated,
-
)
;
+
]
;
}
/**
}
/**
@@
-667,10
+667,10
@@
class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
/**
* Append Drupal8 js to coreResourcesList.
*
/**
* Append Drupal8 js to coreResourcesList.
*
- * @param
array $list
+ * @param
\Civi\Core\Event\GenericHookEvent $e
*/
*/
- public function appendCoreResources(
&$list
) {
- $list[] = 'js/crm.drupal8.js';
+ public function appendCoreResources(
\Civi\Core\Event\GenericHookEvent $e
) {
+ $
e->
list[] = 'js/crm.drupal8.js';
}
}
}
}