コード例 #1
0
/**
* (Delegated) Implements hook_civicrm_angularModules().
*
* Find any and return any files matching "ang/*.ang.php"
*
* Note: This hook only runs in CiviCRM 4.5+.
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_angularModules
*/
function _speakcivi_civix_civicrm_angularModules(&$angularModules)
{
    if (!is_dir(__DIR__ . '/ang')) {
        return;
    }
    $files = _speakcivi_civix_glob(__DIR__ . '/ang/*.ang.php');
    foreach ($files as $file) {
        $name = preg_replace(':\\.ang\\.php$:', '', basename($file));
        $module = (include $file);
        if (empty($module['ext'])) {
            $module['ext'] = 'eu.wemove.speakcivi';
        }
        $angularModules[$name] = $module;
    }
}
コード例 #2
0
/**
 * (Delegated) Implementation of hook_civicrm_caseTypes
 *
 * Find any and return any files matching "xml/case/*.xml"
 *
 * Note: This hook only runs in CiviCRM 4.4+.
 *
 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_caseTypes
 */
function _speakcivi_civix_civicrm_caseTypes(&$caseTypes)
{
    if (!is_dir(__DIR__ . '/xml/case')) {
        return;
    }
    foreach (_speakcivi_civix_glob(__DIR__ . '/xml/case/*.xml') as $file) {
        $name = preg_replace('/\\.xml$/', '', basename($file));
        if ($name != CRM_Case_XMLProcessor::mungeCaseType($name)) {
            $errorMessage = sprintf("Case-type file name is malformed (%s vs %s)", $name, CRM_Case_XMLProcessor::mungeCaseType($name));
            CRM_Core_Error::fatal($errorMessage);
            // throw new CRM_Core_Exception($errorMessage);
        }
        $caseTypes[$name] = array('module' => 'eu.wemove.speakcivi', 'name' => $name, 'file' => $file);
    }
}