}
public function addRules() {
- $this->addFormRule(array('CRM_Contact_Form_Task_RemoveFromTag', 'formRule'));
+ $this->addFormRule(['CRM_Contact_Form_Task_RemoveFromTag', 'formRule']);
}
/**
* @return array
*/
public static function formRule($form, $rule) {
- $errors = array();
+ $errors = [];
if (empty($form['tag']) && empty($form['contact_taglist'])) {
$errors['_qf_default'] = "Please select atleast one tag.";
}
//get the submitted values in an array
$params = $this->controller->exportValues($this->_name);
- $contactTags = $tagList = array();
+ $contactTags = $tagList = [];
// check if contact tags exists
if (!empty($params['tag'])) {
// merge contact and taglist tags
$allTags = CRM_Utils_Array::crmArrayMerge($contactTags, $tagList);
- $this->_name = array();
+ $this->_name = [];
foreach ($allTags as $key => $dnc) {
$this->_name[] = $this->_tags[$key];
list($total, $removed, $notRemoved) = CRM_Core_BAO_EntityTag::removeEntitiesFromTag($this->_contactIds, $key,
'civicrm_contact', FALSE);
- $status = array(
- ts('%count contact un-tagged', array(
- 'count' => $removed,
- 'plural' => '%count contacts un-tagged',
- )),
- );
+ $status = [
+ ts('%count contact un-tagged', [
+ 'count' => $removed,
+ 'plural' => '%count contacts un-tagged',
+ ]),
+ ];
if ($notRemoved) {
- $status[] = ts('1 contact already did not have this tag', array(
- 'count' => $notRemoved,
- 'plural' => '%count contacts already did not have this tag',
- ));
+ $status[] = ts('1 contact already did not have this tag', [
+ 'count' => $notRemoved,
+ 'plural' => '%count contacts already did not have this tag',
+ ]);
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
- CRM_Core_Session::setStatus($status, ts("Removed Tag <em>%1</em>", array(1 => $this->_tags[$key])), 'success', array('expires' => 0));
+ CRM_Core_Session::setStatus($status, ts("Removed Tag <em>%1</em>", [1 => $this->_tags[$key]]), 'success', ['expires' => 0]);
}
}