*/
protected $_gid;
+ /**
+ * The group id that we are editing
+ *
+ * @var string
+ */
+ protected $_ufGroupName = 'unknown';
+
/**
* The group id that we are passing in url
*
$this->_isContactActivityProfile = CRM_Core_BAO_UFField::checkContactActivityProfileType($this->_gid);
//get values for ufGroupName, captch and dupe update.
- $this->assign('ufGroupName', 'unknown'); // override later (if possible)
if ($this->_gid) {
$dao = new CRM_Core_DAO_UFGroup();
$dao->id = $this->_gid;
$this->_isUpdateDupe = $dao->is_update_dupe;
$this->_isAddCaptcha = $dao->add_captcha;
if (!empty($dao->name)) {
- $this->assign('ufGroupName', $dao->name);
+ $this->_ufGroupName = $dao->name;
}
}
$dao->free();
}
+ $this->assign('ufGroupName', $this->_ufGroupName);
$gids = empty($this->_profileIds) ? $this->_gid : $this->_profileIds;
* @access public
*/
public function buildQuickForm() {
+ switch ($this->_mode) {
+ case self::MODE_CREATE:
+ case self::MODE_EDIT:
+ case self::MODE_REGISTER:
+ CRM_Utils_Hook::buildProfile($this->_ufGroupName);
+ break;
+ case self::MODE_SEARCH:
+ CRM_Utils_Hook::searchProfile($this->_ufGroupName);
+ break;
+ default:
+ }
+
//lets have single status message, CRM-4363
$return = FALSE;
$statusMessage = NULL;
* @static
*/
static function formRule($fields, $files, $form) {
+ CRM_Utils_Hook::validateProfile($form->_ufGroupName);
+
$errors = array();
// if no values, return
if (empty($fields)) {
return;
}
}
+ CRM_Utils_Hook::processProfile($this->_ufGroupName);
if (CRM_Utils_Array::value('image_URL', $params)) {
CRM_Contact_BAO_Contact::processImageParams($params);
}
$name = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'name');
$this->assign('ufGroupName', $name);
+ CRM_Utils_Hook::viewProfile($name);
if (strtolower($name) == 'summary_overlay') {
$template->assign('overlayProfile', TRUE);
return self::singleton()->invoke(1, $entityTypes, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_entityTypes'
);
}
+
+ /**
+ * This hook is called while preparing a profile form
+ *
+ * @param string $name
+ * @return void
+ */
+ static function buildProfile($name) {
+ return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_buildProfile');
+ }
+
+ /**
+ * This hook is called while validating a profile form submission
+ *
+ * @param string $name
+ * @return void
+ */
+ static function validateProfile($name) {
+ return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_validateProfile');
+ }
+
+ /**
+ * This hook is called processing a valid profile form submission
+ *
+ * @param string $name
+ * @return void
+ */
+ static function processProfile($name) {
+ return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_processProfile');
+ }
+
+ /**
+ * This hook is called while preparing a read-only profile screen
+ *
+ * @param string $name
+ * @return void
+ */
+ static function viewProfile($name) {
+ return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_viewProfile');
+ }
+
+ /**
+ * This hook is called while preparing a list of contacts (based on a profile)
+ *
+ * @param string $name
+ * @return void
+ */
+ static function searchProfile($name) {
+ return self::singleton()->invoke(1, $name, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_searchProfile');
+ }
}