forked from civicrm/org.civicrm.civicase
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #640 from compucorp/RSE-1543-expose-case-category
- Loading branch information
Showing
3 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
use CRM_Civicase_ExtensionUtil as ExtensionUtil; | ||
use Civi\Angular\ChangeSet; | ||
|
||
/** | ||
* Angular ChangeSet Helper Class. | ||
*/ | ||
class CRM_Civicase_Hook_alterAngular_AngularChangeSet { | ||
|
||
/** | ||
* Returns ChangeSet for the case type category field. | ||
* | ||
* This ChangeSet is needed for the core Case Type create/Edit screen. | ||
* | ||
* @return \Civi\Angular\ChangeSet | ||
* Angular ChangeSet. | ||
*/ | ||
public static function getForCaseTypeCategoryField() { | ||
$path = CRM_Core_Resources::singleton() | ||
->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( | ||
'<p class="error">The case type name selector is invalid, The Instance field will not be available</p>' | ||
); | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<div crm-ui-field="{name: 'caseTypeDetailForm.caseTypeCategory', title: ts('Instance')}"> | ||
<input | ||
name="caseTypeCategory" | ||
crm-ui-id="caseType.case_type_category" | ||
ng-model="caseType.case_type_category" | ||
crm-entityref="{ | ||
entity: 'OptionValue', | ||
api: { | ||
params: {option_group_id: 'case_type_categories'} | ||
}, | ||
select: {allowClear: true, multiple: false, placeholder: ts('Select Instance')}, | ||
}" | ||
class="big crm-form-text" | ||
/> | ||
<a | ||
href="/civicrm/admin/options/case_type_categories?reset=1" | ||
class="crm-option-edit-link medium-popup crm-hover-button" | ||
target="_blank" > | ||
<i aria-hidden="true" title="Edit Instance" class="crm-i fa-wrench"></i> | ||
</a> | ||
</div> |