* @see CRM_Core_Resources::entityRefFilters
*
* @param array $filters
+ * @param array $links
*/
public static function entityRefFilters(&$filters, &$links = NULL) {
self::singleton()->invoke(['filters', 'links'], $filters, $links, self::$_nullObject,
$this->assertEquals($expected, CRM_Core_Resources::isFullyFormedUrl($url));
}
+ /**
+ * Test for hook_civicrm_entityRefFilters().
+ *
+ */
+ public function testEntityRefFiltersHook() {
+ CRM_Utils_Hook_UnitTests::singleton()->setHook('civicrm_entityRefFilters', [$this, 'entityRefFilters']);
+ $data = CRM_Core_Resources::getEntityRefMetadata();
+ $this->assertEquals(count($data['links']['Contact']), 4);
+ $this->assertEquals(!empty($data['links']['Contact']['new_staff']), TRUE);
+ }
+
+ /**
+ * @param array $filters
+ * @param array $links
+ */
+ public function entityRefFilters(&$filters, &$links) {
+ $links['Contact']['new_staff'] = [
+ 'label' => ts('New Staff'),
+ 'url' => '/civicrm/profile/create&reset=1&context=dialog&gid=5',
+ 'type' => 'Individual',
+ 'icon' => 'fa-user',
+ ];
+ }
+
}