From ee322efcdc8923feef6abbad763125a266900ef5 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 2 Dec 2021 13:17:14 -0800 Subject: [PATCH] mixin/ang-php - Convert live Angular modules from `hook_angularModules` to `` --- ext/afform/admin/afform_admin.civix.php | 25 ------------------------- ext/afform/admin/afform_admin.php | 14 -------------- ext/afform/admin/info.xml | 1 + ext/afform/core/afform.civix.php | 25 ------------------------- ext/afform/core/afform.php | 2 -- ext/afform/core/info.xml | 3 +++ ext/afform/html/afform_html.civix.php | 25 ------------------------- ext/afform/html/afform_html.php | 14 -------------- ext/afform/html/info.xml | 3 +++ ext/afform/mock/afform_mock.civix.php | 25 ------------------------- ext/afform/mock/afform_mock.php | 14 -------------- ext/afform/mock/info.xml | 3 +++ 12 files changed, 10 insertions(+), 144 deletions(-) diff --git a/ext/afform/admin/afform_admin.civix.php b/ext/afform/admin/afform_admin.civix.php index 54f6001bfd..203e4ccaec 100644 --- a/ext/afform/admin/afform_admin.civix.php +++ b/ext/afform/admin/afform_admin.civix.php @@ -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. * diff --git a/ext/afform/admin/afform_admin.php b/ext/afform/admin/afform_admin.php index 4952456376..4d2fba42a0 100644 --- a/ext/afform/admin/afform_admin.php +++ b/ext/afform/admin/afform_admin.php @@ -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(). * diff --git a/ext/afform/admin/info.xml b/ext/afform/admin/info.xml index fcd99636a8..07f398ce3d 100644 --- a/ext/afform/admin/info.xml +++ b/ext/afform/admin/info.xml @@ -30,6 +30,7 @@ + ang-php@1.0.0 menu-xml@1.0.0 diff --git a/ext/afform/core/afform.civix.php b/ext/afform/core/afform.civix.php index 4f0d862d2f..ae87df3e49 100644 --- a/ext/afform/core/afform.civix.php +++ b/ext/afform/core/afform.civix.php @@ -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. * diff --git a/ext/afform/core/afform.php b/ext/afform/core/afform.php index 0438defda5..693439979e 100644 --- a/ext/afform/core/afform.php +++ b/ext/afform/core/afform.php @@ -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(); diff --git a/ext/afform/core/info.xml b/ext/afform/core/info.xml index 6fee430d09..eebdba395e 100644 --- a/ext/afform/core/info.xml +++ b/ext/afform/core/info.xml @@ -25,4 +25,7 @@ + + ang-php@1.0.0 + diff --git a/ext/afform/html/afform_html.civix.php b/ext/afform/html/afform_html.civix.php index d7dc9f5f12..8587866506 100644 --- a/ext/afform/html/afform_html.civix.php +++ b/ext/afform/html/afform_html.civix.php @@ -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. * diff --git a/ext/afform/html/afform_html.php b/ext/afform/html/afform_html.php index 0a6fd6e82b..db5f2cde0c 100644 --- a/ext/afform/html/afform_html.php +++ b/ext/afform/html/afform_html.php @@ -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(). * diff --git a/ext/afform/html/info.xml b/ext/afform/html/info.xml index d8dbaa4f0e..dee1db8534 100644 --- a/ext/afform/html/info.xml +++ b/ext/afform/html/info.xml @@ -22,6 +22,9 @@ org.civicrm.afform This extension is experimental and has limited functionality. + + ang-php@1.0.0 + CRM/AfformHtml diff --git a/ext/afform/mock/afform_mock.civix.php b/ext/afform/mock/afform_mock.civix.php index b608ef4f59..0d4f945952 100644 --- a/ext/afform/mock/afform_mock.civix.php +++ b/ext/afform/mock/afform_mock.civix.php @@ -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. * diff --git a/ext/afform/mock/afform_mock.php b/ext/afform/mock/afform_mock.php index d75baf2aa6..a055eaf531 100644 --- a/ext/afform/mock/afform_mock.php +++ b/ext/afform/mock/afform_mock.php @@ -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(). * diff --git a/ext/afform/mock/info.xml b/ext/afform/mock/info.xml index 84ea14bd58..4eb36fa245 100644 --- a/ext/afform/mock/info.xml +++ b/ext/afform/mock/info.xml @@ -24,6 +24,9 @@ org.civicrm.afform Examples and tests for CiviCRM Afforms. + + ang-php@1.0.0 + CRM/AfformMock -- 2.25.1