Skip to content

Instantly share code, notes, and snippets.

@mikespook
Created December 23, 2016 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikespook/0be4aa69d28adabb9dc2852a066651ea to your computer and use it in GitHub Desktop.
Save mikespook/0be4aa69d28adabb9dc2852a066651ea to your computer and use it in GitHub Desktop.
CiviCRM for Drupal 8 patch
diff --git a/civicrm.install b/civicrm.install
index a6bbc99..2531b4c 100644
--- a/civicrm.install
+++ b/civicrm.install
@@ -60,6 +60,7 @@ function civicrm_install() {
* @param $phase
*/
function civicrm_requirements($phase) {
+# require_once DRUPAL_ROOT . "/modules/libraries/libraries.module";
$requirements = array();
$civicrm_base = _civicrm_find_civicrm();
@@ -126,13 +127,13 @@ function civicrm_requirements($phase) {
function _civicrm_find_civicrm() {
if ($path = drupal_get_path('module', 'civicrm')) {
if (file_exists($path . '/CRM/Core/ClassLoader.php')) {
- return \Drupal\Core\File\FileSystem::realpath($path);
+ return \Drupal::service('file_system')->realpath($path);
}
}
if ($path = libraries_get_path('civicrm')) {
if (file_exists($path . '/CRM/Core/ClassLoader.php')) {
- return \Drupal\Core\File\FileSystem::realpath($path);
+ return \Drupal::service('file_system')->realpath($path);
}
}
diff --git a/civicrm.module b/civicrm.module
index c4502a9..a8021b9 100644
--- a/civicrm.module
+++ b/civicrm.module
@@ -93,7 +93,7 @@ function civicrm_entity_extra_field_info() {
* We use this hook to add the pseudo-fields we've added in civicrm_entity_extra_field_info()
* to the user display.
*/
-function civicrm_user_view(array &$build, \Drupal\user\UserInterface $account, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode, $langcode) {
+function civicrm_user_view(array &$build, \Drupal\user\UserInterface $account, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) {
\Drupal::service('civicrm');
// We need the $contact_id so that we know what data to pull out of Civicrm.
@@ -245,4 +245,4 @@ function civicrm_theme() {
*/
function template_preprocess_civicrm_contact(&$vars) {
$vars['civicrm_contact'] = $vars['elements']['#civicrm_contact'];
-}
\ No newline at end of file
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment