From 7e50b197782f0acb60828191405a339c63f9001f Mon Sep 17 00:00:00 2001 From: Mark Hanna Date: Thu, 14 May 2026 16:08:40 -0600 Subject: [PATCH 1/3] more backward compatible, less forward looking option for initial D12 compatibility --- civicrm.info.yml | 2 +- civicrm.module | 1 + modules/civicrmtheme/civicrmtheme.info.yml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/civicrm.info.yml b/civicrm.info.yml index a5e1eb8..1f92368 100644 --- a/civicrm.info.yml +++ b/civicrm.info.yml @@ -2,4 +2,4 @@ name: CiviCRM Core type: module description: 'Constituent Relationship Management system. Allows sites to manage contacts, relationships and groups, and track contact activities, contributions, memberships and events.' package: CiviCRM -core_version_requirement: ^9 || ^10 || ^11 +core_version_requirement: ^9 || ^10 || ^11 || ^12 diff --git a/civicrm.module b/civicrm.module index 0d32868..800c931 100644 --- a/civicrm.module +++ b/civicrm.module @@ -13,6 +13,7 @@ use Symfony\Component\Routing\Route; use Drupal\Core\Render\Markup; require_once 'civicrm.user.inc'; +require_once 'civicrm.install'; /** * Implements hook_page_attachments(). diff --git a/modules/civicrmtheme/civicrmtheme.info.yml b/modules/civicrmtheme/civicrmtheme.info.yml index a877165..a208884 100644 --- a/modules/civicrmtheme/civicrmtheme.info.yml +++ b/modules/civicrmtheme/civicrmtheme.info.yml @@ -2,6 +2,6 @@ name: CiviCRM Theme type: module description: 'Define alternate themes for CiviCRM.' package: CiviCRM -core_version_requirement: ^9 || ^10 || ^11 +core_version_requirement: ^9 || ^10 || ^11 || ^12 dependencies: - civicrm From 7069ecb9c3ca19655b9ca62190e28d2a193f6eb2 Mon Sep 17 00:00:00 2001 From: Mark Hanna Date: Thu, 14 May 2026 16:15:27 -0600 Subject: [PATCH 2/3] add hook_runtime_requirements implementation --- civicrm.install | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/civicrm.install b/civicrm.install index d8c8167..9128aa5 100644 --- a/civicrm.install +++ b/civicrm.install @@ -118,6 +118,72 @@ function civicrm_requirements($phase) { return $requirements; } +/** + * Implements hook_runtime_requirements(). + */ +function civicrm_runtime_requirements() { + $requirements = []; + + $civicrm_base = _civicrm_find_civicrm(); + + // Introduced in 11.2, and then compatibility layer removed in 11.3, so we + // have to support both. + if (class_exists('\Drupal\Core\Extension\Requirement\RequirementSeverity')) { + $severityMap = [ + 'info' => \Drupal\Core\Extension\Requirement\RequirementSeverity::OK, + 'warning' => \Drupal\Core\Extension\Requirement\RequirementSeverity::Warning, + 'error' => \Drupal\Core\Extension\Requirement\RequirementSeverity::Error, + ]; + } + else { + $severityMap = [ + 'info' => REQUIREMENT_OK, + 'warning' => REQUIREMENT_WARNING, + 'error' => REQUIREMENT_ERROR, + ]; + } + + if ($civicrm_base) { + $requirements['civicrm.location'] = [ + 'title' => 'CiviCRM location', + 'severity' => $severityMap['info'], + 'description' => 'CiviCRM core directory', + ]; + } + else { + $requirements['civicrm.location'] = [ + 'title' => 'CiviCRM location', + 'severity' => $severityMap['error'], + 'description' => 'CiviCRM must be installed via composer.', + ]; + return $requirements; + } + + /** @var \Civi\Setup $setup */ + $setup = _civicrm_setup(); + + $sections = [ + 'system' => 'CiviCRM: System', + 'database' => 'CiviCRM: Database', + 'other' => 'CiviCRM: Other', + ]; + + + foreach ($setup->checkRequirements()->getMessages() as $msg) { + $section = isset($sections[$msg['section']]) ? $sections[$msg['section']] : $sections['other']; + $key = 'civicrm.' . $msg['section'] . '.' . $msg['name']; + $requirements[$key] = [ + 'title' => $section . ': ' . $msg['message'], + 'description' => $section . ': ' . $msg['message'], + 'severity' => $severityMap[$msg['severity']], + ]; + } + + ksort($requirements); + + return $requirements; +} + /** * @return \Civi\Setup */ From 000efaec5b820a822c97c806474d07e5922c63a5 Mon Sep 17 00:00:00 2001 From: Mark Hanna Date: Fri, 15 May 2026 15:15:08 -0600 Subject: [PATCH 3/3] remove runtime requirements hook --- civicrm.install | 66 ------------------------------------------------- 1 file changed, 66 deletions(-) diff --git a/civicrm.install b/civicrm.install index 9128aa5..d8c8167 100644 --- a/civicrm.install +++ b/civicrm.install @@ -118,72 +118,6 @@ function civicrm_requirements($phase) { return $requirements; } -/** - * Implements hook_runtime_requirements(). - */ -function civicrm_runtime_requirements() { - $requirements = []; - - $civicrm_base = _civicrm_find_civicrm(); - - // Introduced in 11.2, and then compatibility layer removed in 11.3, so we - // have to support both. - if (class_exists('\Drupal\Core\Extension\Requirement\RequirementSeverity')) { - $severityMap = [ - 'info' => \Drupal\Core\Extension\Requirement\RequirementSeverity::OK, - 'warning' => \Drupal\Core\Extension\Requirement\RequirementSeverity::Warning, - 'error' => \Drupal\Core\Extension\Requirement\RequirementSeverity::Error, - ]; - } - else { - $severityMap = [ - 'info' => REQUIREMENT_OK, - 'warning' => REQUIREMENT_WARNING, - 'error' => REQUIREMENT_ERROR, - ]; - } - - if ($civicrm_base) { - $requirements['civicrm.location'] = [ - 'title' => 'CiviCRM location', - 'severity' => $severityMap['info'], - 'description' => 'CiviCRM core directory', - ]; - } - else { - $requirements['civicrm.location'] = [ - 'title' => 'CiviCRM location', - 'severity' => $severityMap['error'], - 'description' => 'CiviCRM must be installed via composer.', - ]; - return $requirements; - } - - /** @var \Civi\Setup $setup */ - $setup = _civicrm_setup(); - - $sections = [ - 'system' => 'CiviCRM: System', - 'database' => 'CiviCRM: Database', - 'other' => 'CiviCRM: Other', - ]; - - - foreach ($setup->checkRequirements()->getMessages() as $msg) { - $section = isset($sections[$msg['section']]) ? $sections[$msg['section']] : $sections['other']; - $key = 'civicrm.' . $msg['section'] . '.' . $msg['name']; - $requirements[$key] = [ - 'title' => $section . ': ' . $msg['message'], - 'description' => $section . ': ' . $msg['message'], - 'severity' => $severityMap[$msg['severity']], - ]; - } - - ksort($requirements); - - return $requirements; -} - /** * @return \Civi\Setup */