'civicrm/grant/add', 'query' => "reset=1&action=add&context=standalone", 'ref' => 'new-grant', 'title' => ts('Grant'), ]; } } /** * Implements hook_civicrm_permission(). * * Define CiviGrant permissions. */ function civigrant_civicrm_permission(&$permissions) { $permissions['access CiviGrant'] = [ E::ts('access CiviGrant'), E::ts('View all grants'), ]; $permissions['edit grants'] = [ E::ts('edit grants'), E::ts('Create and update grants'), ]; $permissions['delete in CiviGrant'] = [ E::ts('delete in CiviGrant'), E::ts('Delete grants'), ]; } /** * Implements hook_civicrm_tabSet(). * * Add grants tab to contact summary screen. */ function civigrant_civicrm_tabSet($tabSetName, &$tabs, $context) { if ($tabSetName === 'civicrm/contact/view' && !empty($context['contact_id'])) { $cid = $context['contact_id']; $tabs[] = [ 'id' => 'grant', 'url' => CRM_Utils_System::url("civicrm/contact/view/grant", ['reset' => 1, 'cid' => $cid]), 'title' => E::ts('Grants'), 'weight' => 60, 'count' => CRM_Grant_BAO_Grant::getContactGrantCount($cid), 'class' => 'livePage', 'icon' => 'crm-i fa-money', ]; } } /** * Implements hook_civicrm_queryObjects(). * * Adds query object for legacy screens like advanced search, search builder, etc. */ function civigrant_civicrm_queryObjects(&$queryObjects, $type) { if ($type == 'Contact') { $queryObjects[] = new CRM_Grant_BAO_Query(); } elseif ($type == 'Report') { // Do we need to do something here? } }