mixin/ang-php - Convert live Angular modules from `hook_angularModules` to `<mixin>`
authorTim Otten <totten@civicrm.org>
Thu, 2 Dec 2021 21:17:14 +0000 (13:17 -0800)
committerTim Otten <totten@civicrm.org>
Tue, 7 Dec 2021 00:05:51 +0000 (16:05 -0800)
12 files changed:
ext/afform/admin/afform_admin.civix.php
ext/afform/admin/afform_admin.php
ext/afform/admin/info.xml
ext/afform/core/afform.civix.php
ext/afform/core/afform.php
ext/afform/core/info.xml
ext/afform/html/afform_html.civix.php
ext/afform/html/afform_html.php
ext/afform/html/info.xml
ext/afform/mock/afform_mock.civix.php
ext/afform/mock/afform_mock.php
ext/afform/mock/info.xml

index 54f6001bfd8da5d02c1e023f1ebcb85c75c9d351..203e4ccaec065b4ed64b338e6380ddbb07549f44 100644 (file)
@@ -244,31 +244,6 @@ function _afform_admin_civix_civicrm_managed(&$entities) {
   }
 }
 
-/**
- * (Delegated) Implements hook_civicrm_angularModules().
- *
- * Find any and return any files matching "ang/*.ang.php"
- *
- * Note: This hook only runs in CiviCRM 4.5+.
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_angularModules
- */
-function _afform_admin_civix_civicrm_angularModules(&$angularModules) {
-  if (!is_dir(__DIR__ . '/ang')) {
-    return;
-  }
-
-  $files = _afform_admin_civix_glob(__DIR__ . '/ang/*.ang.php');
-  foreach ($files as $file) {
-    $name = preg_replace(':\.ang\.php$:', '', basename($file));
-    $module = include $file;
-    if (empty($module['ext'])) {
-      $module['ext'] = E::LONG_NAME;
-    }
-    $angularModules[$name] = $module;
-  }
-}
-
 /**
  * Glob wrapper which is guaranteed to return an array.
  *
index 4952456376a5cae487577dd154d5fcecf22c65ab..4d2fba42a0be36160bfbe04c1c96b810e3a17720 100644 (file)
@@ -78,20 +78,6 @@ function afform_admin_civicrm_managed(&$entities) {
   _afform_admin_civix_civicrm_managed($entities);
 }
 
-/**
- * Implements hook_civicrm_angularModules().
- *
- * Generate a list of Angular modules.
- *
- * Note: This hook only runs in CiviCRM 4.5+. It may
- * use features only available in v4.6+.
- *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
- */
-function afform_admin_civicrm_angularModules(&$angularModules) {
-  _afform_admin_civix_civicrm_angularModules($angularModules);
-}
-
 /**
  * Implements hook_civicrm_entityTypes().
  *
index fcd99636a87f2115141f7cbe8022a6bbb6b1b8c1..07f398ce3dbdd502dc71f714e33545a98db5aadd 100644 (file)
@@ -30,6 +30,7 @@
     <psr4 prefix="Civi\" path="Civi"/>
   </classloader>
   <mixins>
+    <mixin>ang-php@1.0.0</mixin>
     <mixin>menu-xml@1.0.0</mixin>
   </mixins>
 </extension>
index 4f0d862d2f4bfaba3925990097bf26c293404c96..ae87df3e495f3ffbfb114ef6edd5f53e0bc07d34 100644 (file)
@@ -244,31 +244,6 @@ function _afform_civix_civicrm_managed(&$entities) {
   }
 }
 
-/**
- * (Delegated) Implements hook_civicrm_angularModules().
- *
- * Find any and return any files matching "ang/*.ang.php"
- *
- * Note: This hook only runs in CiviCRM 4.5+.
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_angularModules
- */
-function _afform_civix_civicrm_angularModules(&$angularModules) {
-  if (!is_dir(__DIR__ . '/ang')) {
-    return;
-  }
-
-  $files = _afform_civix_glob(__DIR__ . '/ang/*.ang.php');
-  foreach ($files as $file) {
-    $name = preg_replace(':\.ang\.php$:', '', basename($file));
-    $module = include $file;
-    if (empty($module['ext'])) {
-      $module['ext'] = E::LONG_NAME;
-    }
-    $angularModules[$name] = $module;
-  }
-}
-
 /**
  * Glob wrapper which is guaranteed to return an array.
  *
index 0438defda564dee0d01f7c1d3c64df5018e751ba..693439979e17f7dd62641d06f18657dc42c0bdcc 100644 (file)
@@ -264,8 +264,6 @@ function afform_civicrm_contactSummaryBlocks(&$blocks) {
  * Generate a list of Afform Angular modules.
  */
 function afform_civicrm_angularModules(&$angularModules) {
-  _afform_civix_civicrm_angularModules($angularModules);
-
   $afforms = \Civi\Api4\Afform::get(FALSE)
     ->setSelect(['name', 'requires', 'module_name', 'directive_name'])
     ->execute();
index 6fee430d09e561c399a45e149d0c5389b8481f38..eebdba395e91bb615b2bc9fa8bf06990347886fa 100644 (file)
@@ -25,4 +25,7 @@
   <classloader>
     <psr4 prefix="Civi\" path="Civi"/>
   </classloader>
+  <mixins>
+    <mixin>ang-php@1.0.0</mixin>
+  </mixins>
 </extension>
index d7dc9f5f12edfed40f4c595fc8da194742de2cae..85878665069b8128647b2cd514d66314a4e78e18 100644 (file)
@@ -244,31 +244,6 @@ function _afform_html_civix_civicrm_managed(&$entities) {
   }
 }
 
-/**
- * (Delegated) Implements hook_civicrm_angularModules().
- *
- * Find any and return any files matching "ang/*.ang.php"
- *
- * Note: This hook only runs in CiviCRM 4.5+.
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_angularModules
- */
-function _afform_html_civix_civicrm_angularModules(&$angularModules) {
-  if (!is_dir(__DIR__ . '/ang')) {
-    return;
-  }
-
-  $files = _afform_html_civix_glob(__DIR__ . '/ang/*.ang.php');
-  foreach ($files as $file) {
-    $name = preg_replace(':\.ang\.php$:', '', basename($file));
-    $module = include $file;
-    if (empty($module['ext'])) {
-      $module['ext'] = E::LONG_NAME;
-    }
-    $angularModules[$name] = $module;
-  }
-}
-
 /**
  * Glob wrapper which is guaranteed to return an array.
  *
index 0a6fd6e82be5b811ff1431e923e658de9aacb390..db5f2cde0cd85f7b1483c57fad80a1a29781a2c4 100644 (file)
@@ -82,20 +82,6 @@ function afform_html_civicrm_managed(&$entities) {
   _afform_html_civix_civicrm_managed($entities);
 }
 
-/**
- * Implements hook_civicrm_angularModules().
- *
- * Generate a list of Angular modules.
- *
- * Note: This hook only runs in CiviCRM 4.5+. It may
- * use features only available in v4.6+.
- *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
- */
-function afform_html_civicrm_angularModules(&$angularModules) {
-  _afform_html_civix_civicrm_angularModules($angularModules);
-}
-
 /**
  * Implements hook_civicrm_entityTypes().
  *
index d8dbaa4f0e5fcac4bf52edffde3e39ecb33579d4..dee1db85343eca986b9ec7e30d45b36faeda5fff 100644 (file)
@@ -22,6 +22,9 @@
     <ext>org.civicrm.afform</ext>
   </requires>
   <comments>This extension is experimental and has limited functionality.</comments>
+  <mixins>
+    <mixin>ang-php@1.0.0</mixin>
+  </mixins>
   <civix>
     <namespace>CRM/AfformHtml</namespace>
   </civix>
index b608ef4f590be19a3e62d9be5bc67e7ecf9832ff..0d4f9459528518790ca1cbc979105dc71cce2a70 100644 (file)
@@ -244,31 +244,6 @@ function _afform_mock_civix_civicrm_managed(&$entities) {
   }
 }
 
-/**
- * (Delegated) Implements hook_civicrm_angularModules().
- *
- * Find any and return any files matching "ang/*.ang.php"
- *
- * Note: This hook only runs in CiviCRM 4.5+.
- *
- * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_angularModules
- */
-function _afform_mock_civix_civicrm_angularModules(&$angularModules) {
-  if (!is_dir(__DIR__ . '/ang')) {
-    return;
-  }
-
-  $files = _afform_mock_civix_glob(__DIR__ . '/ang/*.ang.php');
-  foreach ($files as $file) {
-    $name = preg_replace(':\.ang\.php$:', '', basename($file));
-    $module = include $file;
-    if (empty($module['ext'])) {
-      $module['ext'] = E::LONG_NAME;
-    }
-    $angularModules[$name] = $module;
-  }
-}
-
 /**
  * Glob wrapper which is guaranteed to return an array.
  *
index d75baf2aa6e9ef998c402c22cecf4e1aa7d42818..a055eaf5315dfc772a30e8ec59ee0d3c82719634 100644 (file)
@@ -78,20 +78,6 @@ function afform_mock_civicrm_managed(&$entities) {
   _afform_mock_civix_civicrm_managed($entities);
 }
 
-/**
- * Implements hook_civicrm_angularModules().
- *
- * Generate a list of Angular modules.
- *
- * Note: This hook only runs in CiviCRM 4.5+. It may
- * use features only available in v4.6+.
- *
- * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
- */
-function afform_mock_civicrm_angularModules(&$angularModules) {
-  _afform_mock_civix_civicrm_angularModules($angularModules);
-}
-
 /**
  * Implements hook_civicrm_entityTypes().
  *
index 84ea14bd58e86c8e3e06b7f18c5303b7fa72c74e..4eb36fa2452adf19841004b5c500682dbe715abc 100644 (file)
@@ -24,6 +24,9 @@
     <ext>org.civicrm.afform</ext>
   </requires>
   <comments>Examples and tests for CiviCRM Afforms.</comments>
+  <mixins>
+    <mixin>ang-php@1.0.0</mixin>
+  </mixins>
   <civix>
     <namespace>CRM/AfformMock</namespace>
   </civix>