getUrl(self::LONG_NAME), '/'); } return CRM_Core_Resources::singleton()->getUrl(self::LONG_NAME, $file); } /** * Get the path of a resource file (in this extension). * * @param string|NULL $file * Ex: NULL. * Ex: 'css/foo.css'. * @return string * Ex: '/var/www/example.org/sites/default/ext/org.example.foo'. * Ex: '/var/www/example.org/sites/default/ext/org.example.foo/css/foo.css'. */ public static function path($file = NULL) { // return CRM_Core_Resources::singleton()->getPath(self::LONG_NAME, $file); return __DIR__ . ($file === NULL ? '' : (DIRECTORY_SEPARATOR . $file)); } /** * Get the name of a class within this extension. * * @param string $suffix * Ex: 'Page_HelloWorld' or 'Page\\HelloWorld'. * @return string * Ex: 'CRM_Foo_Page_HelloWorld'. */ public static function findClass($suffix) { return self::CLASS_PREFIX . '_' . str_replace('\\', '_', $suffix); } } use CRM_CivicrmAdminUi_ExtensionUtil as E; /** * (Delegated) Implements hook_civicrm_config(). * * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config */ function _civicrm_admin_ui_civix_civicrm_config(&$config = NULL) { static $configured = FALSE; if ($configured) { return; } $configured = TRUE; $template =& CRM_Core_Smarty::singleton(); $extRoot = dirname(__FILE__) . DIRECTORY_SEPARATOR; $extDir = $extRoot . 'templates'; if (is_array($template->template_dir)) { array_unshift($template->template_dir, $extDir); } else { $template->template_dir = [$extDir, $template->template_dir]; } $include_path = $extRoot . PATH_SEPARATOR . get_include_path(); set_include_path($include_path); } /** * (Delegated) Implements hook_civicrm_entityTypes(). * * Find any *.entityType.php files, merge their content, and return. * * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes */ function _civicrm_admin_ui_civix_civicrm_entityTypes(&$entityTypes) { $entityTypes = array_merge($entityTypes, []); }