diff --git a/CRM/Civicase/Hook/alterAngular/AngularChangeSet.php b/CRM/Civicase/Hook/alterAngular/AngularChangeSet.php new file mode 100644 index 000000000..dc6e0f558 --- /dev/null +++ b/CRM/Civicase/Hook/alterAngular/AngularChangeSet.php @@ -0,0 +1,38 @@ +getPath(ExtensionUtil::LONG_NAME, 'templates/CRM/Civicase/ChangeSet/CaseTypeCategory.html'); + $caseTypeCategoryContent = file_get_contents($path); + + return ChangeSet::create('case-type-category') + ->alterHtml('~/crmCaseType/caseTypeDetails.html', function (phpQueryObject $doc) use ($caseTypeCategoryContent) { + $element = $doc->find("div[crm-ui-field*=name: 'caseTypeDetailForm.caseTypeName']"); + if ($element->length) { + $element->after($caseTypeCategoryContent); + } + else { + $doc->find("[ng-form='caseTypeDetailForm']")->prepend( + '
The case type name selector is invalid, The Instance field will not be available
' + ); + } + }); + } + +} diff --git a/civicase.php b/civicase.php index aabf43504..47507c216 100644 --- a/civicase.php +++ b/civicase.php @@ -6,6 +6,7 @@ */ use Civi\Angular\AngularLoader; +use Civi\Angular\Manager; require_once 'civicase.civix.php'; @@ -644,6 +645,15 @@ function civicase_civicrm_summaryActions(&$actions, $contactID) { } } +/** + * Implements hook_civicrm_alterAngular(). + */ +function civicase_civicrm_alterAngular(Manager $angular) { + if (CRM_Core_Permission::check([['administer CiviCase', 'administer CiviCRM']])) { + $angular->add(CRM_Civicase_Hook_alterAngular_AngularChangeSet::getForCaseTypeCategoryField()); + } +} + /** * Adds Case Type Category field to the Case Type entity DAO. * diff --git a/templates/CRM/Civicase/ChangeSet/CaseTypeCategory.html b/templates/CRM/Civicase/ChangeSet/CaseTypeCategory.html new file mode 100644 index 000000000..ba7d9ce95 --- /dev/null +++ b/templates/CRM/Civicase/ChangeSet/CaseTypeCategory.html @@ -0,0 +1,21 @@ +