}
//check petition is valid and active
$params['id'] = $this->_surveyId;
- $this->petition = array();
+ $this->petition = [];
CRM_Campaign_BAO_Survey::retrieve($params, $this->petition);
if (empty($this->petition)) {
CRM_Core_Error::fatal('Petition doesn\'t exist.');
// add the custom contact and activity profile fields to the signature form
- $ufJoinParams = array(
+ $ufJoinParams = [
'entity_id' => $this->_surveyId,
'entity_table' => 'civicrm_survey',
'module' => 'CiviCampaign',
'weight' => 2,
- );
+ ];
$this->_contactProfileId = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
if ($this->_contactProfileId) {
* Set default values for the form.
*/
public function setDefaultValues() {
- $this->_defaults = array();
+ $this->_defaults = [];
if ($this->_contactId) {
CRM_Core_BAO_UFGroup::setProfileDefaults($this->_contactId, $this->_contactProfileFields, $this->_defaults, TRUE);
if ($this->_activityProfileId) {
$this->buildCustom($this->_activityProfileId, 'petitionActivityProfile');
}
// add buttons
- $this->addButtons(array(
- array(
- 'type' => 'upload',
- 'name' => ts('Sign the Petition'),
- 'isDefault' => TRUE,
- ),
- )
- );
+ $this->addButtons([
+ [
+ 'type' => 'upload',
+ 'name' => ts('Sign the Petition'),
+ 'isDefault' => TRUE,
+ ],
+ ]);
}
/**
* @return array|bool
*/
public static function formRule($fields, $files, $errors) {
- $errors = array();
+ $errors = [];
return empty($errors) ? TRUE : $errors;
}
$ids[0] = $this->_contactId;
}
else {
- $ids = CRM_Contact_BAO_Contact::getDuplicateContacts($params, $this->_ctype, 'Unsupervised', array(), FALSE);
+ $ids = CRM_Contact_BAO_Contact::getDuplicateContacts($params, $this->_ctype, 'Unsupervised', [], FALSE);
}
$petition_params['id'] = $this->_surveyId;
- $petition = array();
+ $petition = [];
CRM_Campaign_BAO_Survey::retrieve($petition_params, $petition);
switch (count($ids)) {
}
if ($addCaptcha && !$viewOnly) {
- $captcha = CRM_Utils_ReCAPTCHA::singleton();
- $captcha->add($this);
- $this->assign("isCaptcha", TRUE);
+ CRM_Utils_ReCAPTCHA::enableCaptchaOnForm($this);
}
}
}