Skip to content

Commit

Permalink
Merge pull request #716 from compucorp/RSE-1551-hide-new-case-type-bu…
Browse files Browse the repository at this point in the history
…tton

RSE-1551: Hide New Case Type button on Case Type list
  • Loading branch information
lisandro-compucorp authored Feb 26, 2021
2 parents 32366cc + 5811095 commit a5873a1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions CRM/Civicase/Hook/alterAngular/AngularChangeSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,23 @@ public static function getForCaseTypeCategoryField() {
});
}

/**
* Returns ChangeSet for hiding New Case Type button.
*
* On the case type listing, we don't want to show the "New Case Type" button
* because that action is performed specifically on every "Manage Workflows".
*
* @return \Civi\Angular\ChangeSet
* Angular ChangeSet.
*/
public static function getForHidingNewCaseTypeButton() {
return ChangeSet::create('hide-new-case-type-button')
->alterHtml('~/crmCaseType/list.html', function (phpQueryObject $doc) {
$element = $doc->find("a[ng-href*=#/caseType/new");
if ($element->length) {
$element->remove();
}
});
}

}
1 change: 1 addition & 0 deletions civicase.php
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ function civicase_civicrm_alterAngular(Manager $angular) {
[['administer CiviCase', 'administer CiviCRM']]
)) {
$angular->add(CRM_Civicase_Hook_alterAngular_AngularChangeSet::getForCaseTypeCategoryField());
$angular->add(CRM_Civicase_Hook_alterAngular_AngularChangeSet::getForHidingNewCaseTypeButton());
}
}

Expand Down

0 comments on commit a5873a1

Please sign in to comment.