/**
* SQL function used to format the phone_numeric field via trigger.
+ *
* @see self::triggerInfo()
*
* Note that this is also used by the 4.3 upgrade script.
* @see CRM_Upgrade_Incremental_php_FourThree
*/
const DROP_STRIP_FUNCTION_43 = "DROP FUNCTION IF EXISTS civicrm_strip_non_numeric";
+
const CREATE_STRIP_FUNCTION_43 = "
CREATE FUNCTION civicrm_strip_non_numeric(input VARCHAR(255) CHARACTER SET utf8)
RETURNS VARCHAR(255) CHARACTER SET utf8
*
* @var array
*/
- public static $_commPrefs = array(
+ public static $_commPrefs = [
'do_not_phone',
'do_not_email',
'do_not_mail',
'do_not_sms',
'do_not_trade',
- );
+ ];
/**
* Types of greetings.
*
* @var array
*/
- public static $_greetingTypes = array(
+ public static $_greetingTypes = [
'addressee',
'email_greeting',
'postal_greeting',
- );
+ ];
/**
* Static field for all the contact information that we can potentially import.
*
* @var array
*/
- public static $_importableFields = array();
+ public static $_importableFields = [];
/**
* Static field for all the contact information that we can potentially export.
* @return CRM_Contact_BAO_Contact|CRM_Core_Error|NULL
* Created or updated contact object or error object.
* (error objects are being phased out in favour of exceptions)
+ * @throws \Exception
*/
public static function add(&$params) {
$contact = new CRM_Contact_DAO_Contact();
$contact->id = CRM_Utils_Array::value('contact_id', $params);
- if ($contact->contact_type == 'Individual') {
+ if ($contact->contact_type === 'Individual') {
$allNull = FALSE;
// @todo allow the lines below to be overridden by input or hooks & add tests,
// as has been done for households and organizations.
);
}
- if ($contact->contact_type == 'Individual' && (isset($params['current_employer']) || isset($params['employer_id']))) {
+ if ($contact->contact_type === 'Individual' && (isset($params['current_employer']) || isset($params['employer_id']))) {
// Create current employer.
$newEmployer = !empty($params['employer_id']) ? $params['employer_id'] : CRM_Utils_Array::value('current_employer', $params);
}
// Update cached employer name.
- if ($contact->contact_type == 'Organization') {
+ if ($contact->contact_type === 'Organization') {
CRM_Contact_BAO_Contact_Utils::updateCurrentEmployer($contact->id);
}
* @param bool $skipDelete
* Unclear parameter, passed to website create
*
- * @todo explain this parameter
- *
- * @throws Exception
* @return CRM_Contact_BAO_Contact|CRM_Core_Error
* Created or updated contribution object. We are deprecating returning an error in
* favour of exceptions
+ * @throws Exception
+ * @todo explain this parameter
+ *
*/
public static function &create(&$params, $fixAddress = TRUE, $invokeHooks = TRUE, $skipDelete = FALSE) {
$contact = NULL;
$params['group'][$domainGroupID] = 1;
}
else {
- $params['group'] = array($domainGroupID => 1);
+ $params['group'] = [$domainGroupID => 1];
}
}
}
if (array_key_exists('group', $params)) {
- $contactIds = array($params['contact_id']);
+ $contactIds = [$params['contact_id']];
foreach ($params['group'] as $groupId => $flag) {
if ($flag == 1) {
CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIds, $groupId);
$contactId = $userID;
}
- $noteParams = array(
+ $noteParams = [
'entity_id' => $contact->id,
'entity_table' => 'civicrm_contact',
'note' => $note['note'],
'subject' => CRM_Utils_Array::value('subject', $note),
'contact_id' => $contactId,
- );
+ ];
CRM_Core_BAO_Note::add($noteParams);
}
}
$contactId = $userID;
}
- $noteParams = array(
+ $noteParams = [
'entity_id' => $contact->id,
'entity_table' => 'civicrm_contact',
'note' => $params['note'],
'subject' => CRM_Utils_Array::value('subject', $params),
'contact_id' => $contactId,
- );
+ ];
CRM_Core_BAO_Note::add($noteParams);
}
}
// make a civicrm_subscription_history entry only on contact create (CRM-777)
if (empty($params['contact_id'])) {
- $subscriptionParams = array(
+ $subscriptionParams = [
'contact_id' => $contact->id,
'status' => 'Added',
'method' => 'Admin',
- );
+ ];
CRM_Contact_BAO_SubscriptionHistory::create($subscriptionParams);
}
/**
* Format the output of the create contact function
+ *
* @param CRM_Contact_DAO_Contact[]|array[] $contacts
*/
public static function unsetProtectedFields(&$contacts) {
* (ie. knowing we have definitely tried disambiguates between NULL & not loaded.)
*
* @param array $params
+ *
+ * @throws \CiviCRM_API3_Exception
*/
public static function ensureGreetingParamsAreSet(&$params) {
- $allGreetingParams = array('addressee' => 'addressee_id', 'postal_greeting' => 'postal_greeting_id', 'email_greeting' => 'email_greeting_id');
- $missingGreetingParams = array();
+ $allGreetingParams = ['addressee' => 'addressee_id', 'postal_greeting' => 'postal_greeting_id', 'email_greeting' => 'email_greeting_id'];
+ $missingGreetingParams = [];
foreach ($allGreetingParams as $greetingIndex => $greetingParam) {
if (empty($params[$greetingParam])) {
}
if (!empty($params['contact_id']) && !empty($missingGreetingParams)) {
- $savedGreetings = civicrm_api3('Contact', 'getsingle', array(
+ $savedGreetings = civicrm_api3('Contact', 'getsingle', [
'id' => $params['contact_id'],
'return' => array_keys($missingGreetingParams),
- )
- );
+ ]);
foreach (array_keys($missingGreetingParams) as $missingGreetingParam) {
if (!empty($savedGreetings[$missingGreetingParam . '_custom'])) {
$dao->query($sql);
if ($dao->fetch()) {
$image = CRM_Contact_BAO_Contact_Utils::getImage($dao->contact_sub_type ?
- $dao->contact_sub_type : $dao->contact_type, FALSE, $id
+ $dao->contact_sub_type : $dao->contact_type, FALSE, $id
);
$imageUrl = CRM_Contact_BAO_Contact_Utils::getImage($dao->contact_sub_type ?
- $dao->contact_sub_type : $dao->contact_type, TRUE, $id
+ $dao->contact_sub_type : $dao->contact_type, TRUE, $id
);
// use email if display_name is empty
CRM_Utils_Hook::alterDisplayName($displayName, $id, $dao);
- return $includeTypeInReturnParameters ? array(
+ return $includeTypeInReturnParameters ? [
$displayName,
$image,
$dao->contact_type,
$dao->contact_sub_type,
$imageUrl,
- ) : array($displayName, $image, $imageUrl);
+ ] : [$displayName, $image, $imageUrl];
}
return NULL;
}
* @fixme How does this relate to almost the same thing being done in CRM_Core_Form::formatParamsForPaymentProcessor()
*/
public static function addBillingNameFieldsIfOtherwiseNotSet(&$params) {
- $nameFields = array('first_name', 'middle_name', 'last_name', 'nick_name', 'prefix_id', 'suffix_id');
+ $nameFields = ['first_name', 'middle_name', 'last_name', 'nick_name', 'prefix_id', 'suffix_id'];
foreach ($nameFields as $field) {
if (!empty($params[$field])) {
return;
// The underlying lookupValue function needs some de-fanging. Until that has been unravelled we
// continue to resolve stateprovince lists in descending order of preference & just 'keep trying'.
// prefer matching country..
- $stateProvinceList = CRM_Core_BAO_Address::buildOptions('state_province_id', NULL, array('country_id' => Civi::settings()->get('defaultContactCountry')));
+ $stateProvinceList = CRM_Core_BAO_Address::buildOptions('state_province_id', NULL, ['country_id' => Civi::settings()->get('defaultContactCountry')]);
if (CRM_Utils_Array::lookupValue($values,
'state_province',
$stateProvinceList,
public function createDefaultCrudLink($crudLinkSpec) {
switch ($crudLinkSpec['action']) {
case CRM_Core_Action::VIEW:
- $result = array(
+ $result = [
'title' => $this->display_name,
'path' => 'civicrm/contact/view',
- 'query' => array(
+ 'query' => [
'reset' => 1,
'cid' => $this->id,
- ),
- );
+ ],
+ ];
return $result;
case CRM_Core_Action::UPDATE:
- $result = array(
+ $result = [
'title' => $this->display_name,
'path' => 'civicrm/contact/add',
- 'query' => array(
+ 'query' => [
'reset' => 1,
'action' => 'update',
'cid' => $this->id,
- ),
- );
+ ],
+ ];
return $result;
}
return NULL;
/**
* Get the values for pseudoconstants for name->value and reverse.
*
+ * @param array $defaults
+ * (reference) the default values, some of which need to be resolved.
+ * @param bool $reverse
+ * Always true as this function is only called from one place..
+ *
* @deprecated
*
* This is called specifically from the contact import parser & should be moved there
* as it is not truly a generic function.
*
- * @param array $defaults
- * (reference) the default values, some of which need to be resolved.
- * @param bool $reverse
- * Always true as this function is only called from one place..
*/
public static function resolveDefaults(&$defaults, $reverse = FALSE) {
// Hack for birth_date.
//lookup value of email/postal greeting, addressee, CRM-4575
foreach (self::$_greetingTypes as $greeting) {
- $filterCondition = array(
+ $filterCondition = [
'contact_type' => CRM_Utils_Array::value('contact_type', $defaults),
'greeting_type' => $greeting,
- );
+ ];
CRM_Utils_Array::lookupValue($defaults, $greeting,
CRM_Core_PseudoConstant::greeting($filterCondition), $reverse
);
}
- $blocks = array('address', 'im', 'phone');
+ $blocks = ['address', 'im', 'phone'];
foreach ($blocks as $name) {
if (!array_key_exists($name, $defaults) || !is_array($defaults[$name])) {
continue;
if ($name == 'address') {
// FIXME: lookupValue doesn't work for vcard_name
if (!empty($values['location_type_id'])) {
- $vcardNames = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'vcard_name'));
+ $vcardNames = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', ['labelColumn' => 'vcard_name']);
$values['vcard_name'] = $vcardNames[$values['location_type_id']];
}
unset($params['id']);
//get the block information for this contact
- $entityBlock = array('contact_id' => $params['contact_id']);
+ $entityBlock = ['contact_id' => $params['contact_id']];
$blocks = CRM_Core_BAO_Location::getValues($entityBlock, $microformat);
$defaults = array_merge($defaults, $blocks);
foreach ($blocks as $block => $value) {
// make sure we have edit permission for this contact
// before we delete
if ($checkPermissions && (($skipUndelete && !CRM_Core_Permission::check('delete contacts')) ||
- ($restore && !CRM_Core_Permission::check('access deleted contacts')))
+ ($restore && !CRM_Core_Permission::check('access deleted contacts')))
) {
return FALSE;
}
// CRM-12929
// Restrict contact to be delete if contact has financial trxns
$error = NULL;
- if ($skipUndelete && CRM_Financial_BAO_FinancialItem::checkContactPresent(array($id), $error)) {
+ if ($skipUndelete && CRM_Financial_BAO_FinancialItem::checkContactPresent([$id], $error)) {
return FALSE;
}
// a table-locking query. It still seems a bit inadequate as it assumes the acl users can't see deleted
// but this should not cause any change as long as contacts are not being trashed outside the
// main functions for that.
- CRM_Core_DAO::executeQuery('DELETE FROM civicrm_acl_contact_cache WHERE contact_id = %1', array(1 => array($contactID, 'Integer')));
+ CRM_Core_DAO::executeQuery('DELETE FROM civicrm_acl_contact_cache WHERE contact_id = %1', [1 => [$contactID, 'Integer']]);
}
else {
CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
$imageThumbWidth = round($thumbWidth * $imageRatio);
}
- return array($imageThumbWidth, $imageThumbHeight);
+ return [$imageThumbWidth, $imageThumbHeight];
}
/**
$statusMsg = NULL,
$opType = 'status'
) {
- $mimeType = array(
+ $mimeType = [
'image/jpeg',
'image/jpg',
'image/png',
'image/p-jpeg',
'image/gif',
'image/x-png',
- );
+ ];
if (in_array($params[$imageIndex]['type'], $mimeType)) {
$photo = basename($params[$imageIndex]['name']);
* @return bool
*/
public static function contactTrashRestore($contact, $restore = FALSE) {
- $updateParams = array(
+ $updateParams = [
'id' => $contact->id,
'is_deleted' => $restore ? 0 : 1,
- );
+ ];
CRM_Utils_Hook::pre('update', $contact->contact_type, $contact->id, $updateParams);
- $params = array(1 => array($contact->id, 'Integer'));
+ $params = [1 => [$contact->id, 'Integer']];
if (!$restore) {
$query = "DELETE FROM civicrm_uf_match WHERE contact_id = %1";
CRM_Core_DAO::executeQuery($query, $params);
public static function getContactSubType($id, $implodeDelimiter = NULL) {
$subtype = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $id, 'contact_sub_type');
if (!$subtype) {
- return $implodeDelimiter ? NULL : array();
+ return $implodeDelimiter ? NULL : [];
}
$subtype = CRM_Utils_Array::explodePadded($subtype);
* @return array
*/
public static function getContactTypes($id) {
- $params = array('id' => $id);
- $details = array();
+ $params = ['id' => $id];
+ $details = [];
$contact = CRM_Core_DAO::commonRetrieve('CRM_Contact_DAO_Contact',
$params,
$details,
- array('contact_type', 'contact_sub_type')
+ ['contact_type', 'contact_sub_type']
);
if ($contact) {
- $contactTypes = array();
+ $contactTypes = [];
if ($contact->contact_sub_type) {
$contactTypes = CRM_Utils_Array::explodePadded($contact->contact_sub_type);
}
$fields = CRM_Contact_DAO_Contact::import();
// get the fields thar are meant for contact types
- if (in_array($contactType, array(
+ if (in_array($contactType, [
'Individual',
'Household',
'Organization',
'All',
- ))) {
+ ])) {
$fields = array_merge($fields, CRM_Core_OptionValue::getFields('', $contactType));
}
);
//unset the fields, which are not related to their
//contact type.
- $commonValues = array(
- 'Individual' => array(
+ $commonValues = [
+ 'Individual' => [
'household_name',
'legal_name',
'sic_code',
'organization_name',
- ),
- 'Household' => array(
+ ],
+ 'Household' => [
'first_name',
'middle_name',
'last_name',
'home_URL',
'is_deceased',
'deceased_date',
- ),
- 'Organization' => array(
+ ],
+ 'Organization' => [
'first_name',
'middle_name',
'last_name',
'household_name',
'is_deceased',
'deceased_date',
- ),
- );
+ ],
+ ];
foreach ($commonValues[$contactType] as $value) {
unset($fields[$value]);
}
}
else {
- foreach (array('Individual', 'Household', 'Organization') as $type) {
+ foreach (['Individual', 'Household', 'Organization'] as $type) {
$fields = array_merge($fields,
CRM_Core_BAO_CustomField::getFieldsForImport($type,
$showAll,
}
if ($isProfile) {
- $fields = array_merge($fields, array(
- 'group' => array(
+ $fields = array_merge($fields, [
+ 'group' => [
'title' => ts('Group(s)'),
'name' => 'group',
- ),
- 'tag' => array(
+ ],
+ 'tag' => [
'title' => ts('Tag(s)'),
'name' => 'tag',
- ),
- 'note' => array(
+ ],
+ 'note' => [
'title' => ts('Note'),
'name' => 'note',
- ),
- 'communication_style_id' => array(
+ ],
+ 'communication_style_id' => [
'title' => ts('Communication Style'),
'name' => 'communication_style_id',
- ),
- ));
+ ],
+ ]);
}
//Sorting fields in alphabetical order(CRM-1507)
if (!$isProfile) {
if (!$status) {
- $fields = array_merge(array('do_not_import' => array('title' => ts('- do not import -'))),
+ $fields = array_merge(['do_not_import' => ['title' => ts('- do not import -')]],
self::$_importableFields[$cacheKeyString]
);
}
else {
- $fields = array_merge(array('' => array('title' => ts('- Contact Fields -'))),
+ $fields = array_merge(['' => ['title' => ts('- Contact Fields -')]],
self::$_importableFields[$cacheKeyString]
);
}
*
* @param bool $withMultiRecord
* @param bool $checkPermissions
+ *
* @return array
* array of exportable Fields
*/
if (!self::$_exportableFields || !CRM_Utils_Array::value($cacheKeyString, self::$_exportableFields)) {
if (!self::$_exportableFields) {
- self::$_exportableFields = array();
+ self::$_exportableFields = [];
}
// check if we can retrieve from database cache
$fields = CRM_Contact_DAO_Contact::export();
// The fields are meant for contact types.
- if (in_array($contactType, array(
+ if (in_array($contactType, [
'Individual',
'Household',
'Organization',
'All',
- ))) {
+ ])) {
$fields = array_merge($fields, CRM_Core_OptionValue::getFields('', $contactType));
}
// add current employer for individuals
- $fields = array_merge($fields, array(
+ $fields = array_merge($fields, [
'current_employer' =>
- array(
+ [
'name' => 'organization_name',
'title' => ts('Current Employer'),
- ),
- ));
+ ],
+ ]);
- $locationType = array(
- 'location_type' => array(
+ $locationType = [
+ 'location_type' => [
'name' => 'location_type',
'where' => 'civicrm_location_type.name',
'title' => ts('Location Type'),
- ),
- );
+ ],
+ ];
- $IMProvider = array(
- 'im_provider' => array(
+ $IMProvider = [
+ 'im_provider' => [
'name' => 'im_provider',
'where' => 'civicrm_im.provider_id',
'title' => ts('IM Provider'),
- ),
- );
+ ],
+ ];
$locationFields = array_merge($locationType,
CRM_Core_DAO_Address::export(),
);
}
else {
- foreach (array(
- 'Individual',
- 'Household',
- 'Organization',
- ) as $type) {
+ foreach (['Individual', 'Household', 'Organization'] as $type) {
$fields = array_merge($fields,
CRM_Core_BAO_CustomField::getFieldsForImport($type, FALSE, FALSE, $search, $checkPermissions, $withMultiRecord)
);
$fields['current_employer_id']['title'] = ts('Current Employer ID');
//fix for CRM-791
if ($export) {
- $fields = array_merge($fields, array(
- 'groups' => array(
+ $fields = array_merge($fields, [
+ 'groups' => [
'title' => ts('Group(s)'),
'name' => 'groups',
- ),
- 'tags' => array(
+ ],
+ 'tags' => [
'title' => ts('Tag(s)'),
'name' => 'tags',
- ),
- 'notes' => array(
+ ],
+ 'notes' => [
'title' => ts('Note(s)'),
'name' => 'notes',
- ),
- ));
+ ],
+ ]);
}
else {
- $fields = array_merge($fields, array(
- 'group' => array(
+ $fields = array_merge($fields, [
+ 'group' => [
'title' => ts('Group(s)'),
'name' => 'group',
- ),
- 'tag' => array(
+ ],
+ 'tag' => [
'title' => ts('Tag(s)'),
'name' => 'tag',
- ),
- 'note' => array(
+ ],
+ 'note' => [
'title' => ts('Note(s)'),
'name' => 'note',
- ),
- ));
+ ],
+ ]);
}
//Sorting fields in alphabetical order(CRM-1507)
$fields = array_merge($sortArray, $fields);
//unset the field which are not related to their contact type.
if ($contactType != 'All') {
- $commonValues = array(
- 'Individual' => array(
+ $commonValues = [
+ 'Individual' => [
'household_name',
'legal_name',
'sic_code',
'email_greeting_custom',
'postal_greeting_custom',
'addressee_custom',
- ),
- 'Household' => array(
+ ],
+ 'Household' => [
'first_name',
'middle_name',
'last_name',
'addressee_custom',
'prefix_id',
'suffix_id',
- ),
- 'Organization' => array(
+ ],
+ 'Organization' => [
'first_name',
'middle_name',
'last_name',
'is_deceased',
'deceased_date',
'current_employer',
- ),
- );
+ ],
+ ];
foreach ($commonValues[$contactType] as $value) {
unset($fields[$value]);
}
$fields = self::$_exportableFields[$cacheKeyString];
}
else {
- $fields = array_merge(array('' => array('title' => ts('- Contact Fields -'))),
+ $fields = array_merge(['' => ['title' => ts('- Contact Fields -')]],
self::$_exportableFields[$cacheKeyString]
);
}
* Contact details
*/
public static function getHierContactDetails($contactId, $fields) {
- $params = array(array('contact_id', '=', $contactId, 0, 0));
- $options = array();
+ $params = [['contact_id', '=', $contactId, 0, 0]];
+ $options = [];
$returnProperties = self::makeHierReturnProperties($fields, $contactId);
public static function &makeHierReturnProperties($fields, $contactId = NULL) {
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
- $returnProperties = array();
+ $returnProperties = [];
- $multipleFields = array('website' => 'url');
+ $multipleFields = ['website' => 'url'];
foreach ($fields as $name => $dontCare) {
if (strpos($name, '-') !== FALSE) {
list($fieldName, $id, $type) = CRM_Utils_System::explode('-', $name, 3);
}
if (empty($returnProperties['location'])) {
- $returnProperties['location'] = array();
+ $returnProperties['location'] = [];
}
if (empty($returnProperties['location'][$locationTypeName])) {
- $returnProperties['location'][$locationTypeName] = array();
+ $returnProperties['location'][$locationTypeName] = [];
$returnProperties['location'][$locationTypeName]['location_type'] = $id;
}
- if (in_array($fieldName, array(
+ if (in_array($fieldName, [
'phone',
'im',
'email',
'openid',
'phone_ext',
- ))) {
+ ])) {
if ($type) {
$returnProperties['location'][$locationTypeName][$fieldName . '-' . $type] = 1;
}
*/
public static function getPrimaryLocationType($contactId, $skipDefaultPriamry = FALSE, $block = NULL) {
if ($block) {
- $entityBlock = array('contact_id' => $contactId);
+ $entityBlock = ['contact_id' => $contactId];
$blocks = CRM_Core_BAO_Location::getValues($entityBlock);
foreach ($blocks[$block] as $key => $value) {
if (!empty($value['is_primary'])) {
LEFT JOIN civicrm_openid ON ( civicrm_openid.is_primary = 1 AND civicrm_openid.contact_id = civicrm_contact.id)
WHERE civicrm_contact.id = %1 ";
- $params = array(1 => array($contactId, 'Integer'));
+ $params = [1 => [$contactId, 'Integer']];
$dao = CRM_Core_DAO::executeQuery($query, $params);
FROM civicrm_contact LEFT JOIN civicrm_email ON (civicrm_contact.id = civicrm_email.contact_id)
WHERE civicrm_contact.id = %1
ORDER BY civicrm_email.is_primary DESC";
- $params = array(1 => array($id, 'Integer'));
+ $params = [1 => [$id, 'Integer']];
$dao = CRM_Core_DAO::executeQuery($sql, $params);
if ($dao->fetch()) {
$doNotEmail = $dao->do_not_email ? TRUE : FALSE;
$onHold = $dao->on_hold ? TRUE : FALSE;
$isDeceased = $dao->is_deceased ? TRUE : FALSE;
- return array($name, $email, $doNotEmail, $onHold, $isDeceased);
+ return [$name, $email, $doNotEmail, $onHold, $isDeceased];
}
- return array(NULL, NULL, NULL, NULL, NULL);
+ return [NULL, NULL, NULL, NULL, NULL];
}
/**
$data['is_opt_out'] = $isOptOut;
// on change, create new civicrm_subscription_history entry
if (($wasOptOut != $isOptOut) && !empty($contactDetails['contact_id'])) {
- $shParams = array(
+ $shParams = [
'contact_id' => $contactDetails['contact_id'],
'status' => $isOptOut ? 'Removed' : 'Added',
'method' => 'Web',
- );
+ ];
CRM_Contact_BAO_SubscriptionHistory::create($shParams);
}
}
//to add profile in default group
if (is_array($addToGroupID)) {
- $contactIds = array($contactID);
+ $contactIds = [$contactID];
foreach ($addToGroupID as $groupId) {
CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIds, $groupId);
}
}
elseif ($addToGroupID) {
- $contactIds = array($contactID);
+ $contactIds = [$contactID];
CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIds, $addToGroupID);
}
$skipCustom = FALSE
) {
- $data = $contactDetails = array();
+ $data = $contactDetails = [];
// get the contact details (hier)
if ($contactID) {
$data['household_name'] = CRM_Utils_Array::value('household_name', $contactDetails);
}
- $locationType = array();
+ $locationType = [];
$count = 1;
if ($contactID) {
$billingLocationTypeId = CRM_Core_BAO_LocationType::getBilling();
- $blocks = array('email', 'phone', 'im', 'openid');
+ $blocks = ['email', 'phone', 'im', 'openid'];
- $multiplFields = array('url');
+ $multiplFields = ['url'];
// prevent overwritten of formatted array, reset all block from
// params if it is not in valid format (since import pass valid format)
foreach ($blocks as $blk) {
$data[$blockName][$loc]['is_primary'] = 1;
}
- if (in_array($fieldName, array('phone'))) {
+ if (in_array($fieldName, ['phone'])) {
if ($typeId) {
$data['phone'][$loc]['phone_type_id'] = $typeId;
}
FALSE
);
}
- elseif ($key == 'edit') {
+ elseif ($key === 'edit') {
continue;
}
else {
- if ($key == 'location') {
+ if ($key === 'location') {
foreach ($value as $locationTypeId => $field) {
foreach ($field as $block => $val) {
- if ($block == 'address' && array_key_exists('address_name', $val)) {
+ if ($block === 'address' && array_key_exists('address_name', $val)) {
$value[$locationTypeId][$block]['name'] = $value[$locationTypeId][$block]['address_name'];
}
}
}
}
- if ($key == 'phone' && isset($params['phone_ext'])) {
+ if ($key === 'phone' && isset($params['phone_ext'])) {
$data[$key] = $value;
foreach ($value as $cnt => $phoneBlock) {
if ($params[$key][$cnt]['location_type_id'] == $params['phone_ext'][$cnt]['location_type_id']) {
}
}
}
- elseif (in_array($key, array(
- 'nick_name',
- 'job_title',
- 'middle_name',
- 'birth_date',
- 'gender_id',
- 'current_employer',
- 'prefix_id',
- 'suffix_id',
- )) && ($value == '' || !isset($value)) &&
- ($session->get('authSrc') & (CRM_Core_Permission::AUTH_SRC_CHECKSUM + CRM_Core_Permission::AUTH_SRC_LOGIN)) == 0 ||
- ($key == 'current_employer' && empty($params['current_employer']))) {
+ elseif (in_array($key, ['nick_name', 'job_title', 'middle_name', 'birth_date', 'gender_id', 'current_employer', 'prefix_id', 'suffix_id'])
+ && ($value == '' || !isset($value)) &&
+ ($session->get('authSrc') & (CRM_Core_Permission::AUTH_SRC_CHECKSUM + CRM_Core_Permission::AUTH_SRC_LOGIN)) == 0 ||
+ ($key === 'current_employer' && empty($params['current_employer']))) {
// CRM-10128: if auth source is not checksum / login && $value is blank, do not fill $data with empty value
// to avoid update with empty values
continue;
}
}
- return array($data, $contactDetails);
+ return [$data, $contactDetails];
}
/**
$query .= "
WHERE civicrm_email.email = %1 AND civicrm_contact.is_deleted=0";
- $p = array(1 => array($mail, 'String'));
+ $p = [1 => [$mail, 'String']];
if ($ctype) {
$query .= " AND civicrm_contact.contact_type = %3";
- $p[3] = array($ctype, 'String');
+ $p[3] = [$ctype, 'String'];
}
$query .= " ORDER BY civicrm_email.is_primary DESC";
FROM civicrm_contact
INNER JOIN civicrm_openid ON ( civicrm_contact.id = civicrm_openid.contact_id )
WHERE civicrm_openid.openid = %1";
- $p = array(1 => array($openId, 'String'));
+ $p = [1 => [$openId, 'String']];
if ($ctype) {
$query .= " AND civicrm_contact.contact_type = %3";
- $p[3] = array($ctype, 'String');
+ $p[3] = [$ctype, 'String'];
}
$query .= " ORDER BY civicrm_openid.is_primary DESC";
LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id )
WHERE civicrm_email.is_primary = 1
AND civicrm_contact.id = %1";
- $p = array(1 => array($contactID, 'Integer'));
+ $p = [1 => [$contactID, 'Integer']];
$dao = CRM_Core_DAO::executeQuery($query, $p);
$email = NULL;
LEFT JOIN civicrm_openid ON ( civicrm_contact.id = civicrm_openid.contact_id )
WHERE civicrm_contact.id = %1
AND civicrm_openid.is_primary = 1";
- $p = array(1 => array($contactID, 'Integer'));
+ $p = [1 => [$contactID, 'Integer']];
$dao = CRM_Core_DAO::executeQuery($query, $p);
$openId = NULL;
CRM_Core_DAO::storeValues($contact, $values);
- $privacy = array();
+ $privacy = [];
foreach (self::$_commPrefs as $name) {
if (isset($contact->$name)) {
$privacy[$name] = $contact->$name;
}
// communication Prefferance
- $preffComm = $comm = array();
+ $preffComm = $comm = [];
$comm = explode(CRM_Core_DAO::VALUE_SEPARATOR,
$contact->preferred_communication_method
);
foreach ($comm as $value) {
$preffComm[$value] = 1;
}
- $temp = array('preferred_communication_method' => $contact->preferred_communication_method);
+ $temp = ['preferred_communication_method' => $contact->preferred_communication_method];
- $names = array(
- 'preferred_communication_method' => array(
+ $names = [
+ 'preferred_communication_method' => [
'newName' => 'preferred_communication_method_display',
'groupName' => 'preferred_communication_method',
- ),
- );
+ ],
+ ];
// @todo This can be figured out from metadata & we can avoid the uncached query.
CRM_Core_OptionGroup::lookupValues($temp, $names, FALSE);
return CRM_Grant_BAO_Grant::getContactGrantCount($contactId);
case 'activity':
- $input = array(
+ $input = [
'contact_id' => $contactId,
'admin' => FALSE,
'caseId' => NULL,
'context' => 'activity',
- );
+ ];
return CRM_Activity_BAO_Activity::getActivitiesCount($input);
case 'mailing':
- $params = array('contact_id' => $contactId);
+ $params = ['contact_id' => $contactId];
return CRM_Mailing_BAO_Mailing::getContactMailingsCount($params);
default:
}
// store object values to an array
- $contactDetails = array();
+ $contactDetails = [];
CRM_Core_DAO::storeValues($contact, $contactDetails);
- $contactDetails = array(array($contact->id => $contactDetails));
+ $contactDetails = [[$contact->id => $contactDetails]];
$emailGreetingString = $postalGreetingString = $addresseeString = NULL;
- $updateQueryString = array();
+ $updateQueryString = [];
//cache email and postal greeting to greeting display
if ($contact->email_greeting_custom != 'null' && $contact->email_greeting_custom) {
}
elseif ($contact->email_greeting_id != 'null' && $contact->email_greeting_id) {
// the filter value for Individual contact type is set to 1
- $filter = array(
+ $filter = [
'contact_type' => $contact->contact_type,
'greeting_type' => 'email_greeting',
- );
+ ];
$emailGreeting = CRM_Core_PseudoConstant::greeting($filter);
$emailGreetingString = $emailGreeting[$contact->email_greeting_id];
}
//postal greetings
- if ($contact->postal_greeting_custom != 'null' && $contact->postal_greeting_custom) {
+ if ($contact->postal_greeting_custom !== 'null' && $contact->postal_greeting_custom) {
$postalGreetingString = $contact->postal_greeting_custom;
}
- elseif ($contact->postal_greeting_id != 'null' && $contact->postal_greeting_id) {
- $filter = array(
+ elseif ($contact->postal_greeting_id !== 'null' && $contact->postal_greeting_id) {
+ $filter = [
'contact_type' => $contact->contact_type,
'greeting_type' => 'postal_greeting',
- );
+ ];
$postalGreeting = CRM_Core_PseudoConstant::greeting($filter);
$postalGreetingString = $postalGreeting[$contact->postal_greeting_id];
$updateQueryString[] = " postal_greeting_custom = NULL ";
}
// addressee
- if ($contact->addressee_custom != 'null' && $contact->addressee_custom) {
+ if ($contact->addressee_custom !== 'null' && $contact->addressee_custom) {
$addresseeString = $contact->addressee_custom;
}
- elseif ($contact->addressee_id != 'null' && $contact->addressee_id) {
- $filter = array(
+ elseif ($contact->addressee_id !== 'null' && $contact->addressee_id) {
+ $filter = [
'contact_type' => $contact->contact_type,
'greeting_type' => 'addressee',
- );
+ ];
$addressee = CRM_Core_PseudoConstant::greeting($filter);
$addresseeString = $addressee[$contact->addressee_id];
* @return array
* loc block ids which fulfill condition.
*/
- public static function getLocBlockIds($contactId, $criteria = array(), $condOperator = 'AND') {
- $locBlockIds = array();
+ public static function getLocBlockIds($contactId, $criteria = [], $condOperator = 'AND') {
+ $locBlockIds = [];
if (!$contactId) {
return $locBlockIds;
}
- foreach (array('Email', 'OpenID', 'Phone', 'Address', 'IM') as $block) {
+ foreach (['Email', 'OpenID', 'Phone', 'Address', 'IM'] as $block) {
$name = strtolower($block);
$className = "CRM_Core_DAO_$block";
$blockDAO = new $className();
// build the condition.
if (is_array($criteria)) {
$fields = $blockDAO->fields();
- $conditions = array();
+ $conditions = [];
foreach ($criteria as $field => $value) {
if (array_key_exists($field, $fields)) {
$cond = "( $field = $value )";
// value might be zero or null.
- if (!$value || strtolower($value) == 'null') {
+ if (!$value || strtolower($value) === 'null') {
$cond = "( $field = 0 OR $field IS NULL )";
}
$conditions[] = $cond;
* Array of context menu for logged in user.
*/
public static function contextMenu($contactId = NULL) {
- $menu = array(
- 'view' => array(
+ $menu = [
+ 'view' => [
'title' => ts('View Contact'),
'weight' => 0,
'ref' => 'view-contact',
'class' => 'no-popup',
'key' => 'view',
- 'permissions' => array('view all contacts'),
- ),
- 'add' => array(
+ 'permissions' => ['view all contacts'],
+ ],
+ 'add' => [
'title' => ts('Edit Contact'),
'weight' => 0,
'ref' => 'edit-contact',
'class' => 'no-popup',
'key' => 'add',
- 'permissions' => array('edit all contacts'),
- ),
- 'delete' => array(
+ 'permissions' => ['edit all contacts'],
+ ],
+ 'delete' => [
'title' => ts('Delete Contact'),
'weight' => 0,
'ref' => 'delete-contact',
'key' => 'delete',
- 'permissions' => array('access deleted contacts', 'delete contacts'),
- ),
- 'contribution' => array(
+ 'permissions' => ['access deleted contacts', 'delete contacts'],
+ ],
+ 'contribution' => [
'title' => ts('Add Contribution'),
'weight' => 5,
'ref' => 'new-contribution',
'href' => CRM_Utils_System::url('civicrm/contact/view/contribution',
'reset=1&action=add&context=contribution'
),
- 'permissions' => array(
+ 'permissions' => [
'access CiviContribute',
'edit contributions',
- ),
- ),
- 'participant' => array(
+ ],
+ ],
+ 'participant' => [
'title' => ts('Register for Event'),
'weight' => 10,
'ref' => 'new-participant',
'tab' => 'participant',
'component' => 'CiviEvent',
'href' => CRM_Utils_System::url('civicrm/contact/view/participant', 'reset=1&action=add&context=participant'),
- 'permissions' => array(
+ 'permissions' => [
'access CiviEvent',
'edit event participants',
- ),
- ),
- 'activity' => array(
+ ],
+ ],
+ 'activity' => [
'title' => ts('Record Activity'),
'weight' => 35,
'ref' => 'new-activity',
'key' => 'activity',
- 'permissions' => array('edit all contacts'),
- ),
- 'pledge' => array(
+ 'permissions' => ['edit all contacts'],
+ ],
+ 'pledge' => [
'title' => ts('Add Pledge'),
'weight' => 15,
'ref' => 'new-pledge',
'reset=1&action=add&context=pledge'
),
'component' => 'CiviPledge',
- 'permissions' => array(
+ 'permissions' => [
'access CiviPledge',
'edit pledges',
- ),
- ),
- 'membership' => array(
+ ],
+ ],
+ 'membership' => [
'title' => ts('Add Membership'),
'weight' => 20,
'ref' => 'new-membership',
'href' => CRM_Utils_System::url('civicrm/contact/view/membership',
'reset=1&action=add&context=membership'
),
- 'permissions' => array(
+ 'permissions' => [
'access CiviMember',
'edit memberships',
- ),
- ),
- 'case' => array(
+ ],
+ ],
+ 'case' => [
'title' => ts('Add Case'),
'weight' => 25,
'ref' => 'new-case',
'tab' => 'case',
'component' => 'CiviCase',
'href' => CRM_Utils_System::url('civicrm/case/add', 'reset=1&action=add&context=case'),
- 'permissions' => array('add cases'),
- ),
- 'grant' => array(
+ 'permissions' => ['add cases'],
+ ],
+ 'grant' => [
'title' => ts('Add Grant'),
'weight' => 26,
'ref' => 'new-grant',
'href' => CRM_Utils_System::url('civicrm/contact/view/grant',
'reset=1&action=add&context=grant'
),
- 'permissions' => array('edit grants'),
- ),
- 'rel' => array(
+ 'permissions' => ['edit grants'],
+ ],
+ 'rel' => [
'title' => ts('Add Relationship'),
'weight' => 30,
'ref' => 'new-relationship',
'href' => CRM_Utils_System::url('civicrm/contact/view/rel',
'reset=1&action=add'
),
- 'permissions' => array('edit all contacts'),
- ),
- 'note' => array(
+ 'permissions' => ['edit all contacts'],
+ ],
+ 'note' => [
'title' => ts('Add Note'),
'weight' => 40,
'ref' => 'new-note',
'href' => CRM_Utils_System::url('civicrm/contact/view/note',
'reset=1&action=add'
),
- 'permissions' => array('edit all contacts'),
- ),
- 'email' => array(
+ 'permissions' => ['edit all contacts'],
+ ],
+ 'email' => [
'title' => ts('Send an Email'),
'weight' => 45,
'ref' => 'new-email',
'key' => 'email',
- 'permissions' => array('view all contacts'),
- ),
- 'group' => array(
+ 'permissions' => ['view all contacts'],
+ ],
+ 'group' => [
'title' => ts('Add to Group'),
'weight' => 50,
'ref' => 'group-add-contact',
'key' => 'group',
'tab' => 'group',
- 'permissions' => array('edit groups'),
- ),
- 'tag' => array(
+ 'permissions' => ['edit groups'],
+ ],
+ 'tag' => [
'title' => ts('Tag Contact'),
'weight' => 55,
'ref' => 'tag-contact',
'key' => 'tag',
'tab' => 'tag',
- 'permissions' => array('edit all contacts'),
- ),
- );
+ 'permissions' => ['edit all contacts'],
+ ],
+ ];
- $menu['otherActions'] = array(
- 'print' => array(
+ $menu['otherActions'] = [
+ 'print' => [
'title' => ts('Print Summary'),
'description' => ts('Printer-friendly view of this page.'),
'weight' => 5,
),
'class' => 'print',
'icon' => 'crm-i fa-print',
- ),
- 'vcard' => array(
+ ],
+ 'vcard' => [
'title' => ts('vCard'),
'description' => ts('vCard record for this contact.'),
'weight' => 10,
),
'class' => 'vcard',
'icon' => 'crm-i fa-list-alt',
- ),
- );
+ ],
+ ];
if (CRM_Core_Permission::check('access Contact Dashboard')) {
- $menu['otherActions']['dashboard'] = array(
+ $menu['otherActions']['dashboard'] = [
'title' => ts('Contact Dashboard'),
'description' => ts('Contact Dashboard'),
'weight' => 15,
// as CRM_Core_Config::singleton()->userSystem->getUserRecordUrl($contactId)
'href' => CRM_Utils_System::url('civicrm/user', "reset=1&id={$contactId}"),
'icon' => 'crm-i fa-tachometer',
- );
+ ];
}
$uid = CRM_Core_BAO_UFMatch::getUFId($contactId);
if ($uid) {
- $menu['otherActions']['user-record'] = array(
+ $menu['otherActions']['user-record'] = [
'title' => ts('User Record'),
'description' => ts('User Record'),
'weight' => 20,
'class' => 'user-record',
'href' => CRM_Core_Config::singleton()->userSystem->getUserRecordUrl($contactId),
'icon' => 'crm-i fa-user',
- );
+ ];
}
elseif (CRM_Core_Config::singleton()->userSystem->checkPermissionAddUser()) {
- $menu['otherActions']['user-add'] = array(
+ $menu['otherActions']['user-add'] = [
'title' => ts('Create User Record'),
'description' => ts('Create User Record'),
'weight' => 25,
'class' => 'user-add',
'href' => CRM_Utils_System::url('civicrm/contact/view/useradd', 'reset=1&action=add&cid=' . $contactId),
'icon' => 'crm-i fa-user-plus',
- );
+ ];
}
CRM_Utils_Hook::summaryActions($menu, $contactId);
//3. check for acls.
//3. edit and view contact are directly accessible to user.
- $aclPermissionedTasks = array(
+ $aclPermissionedTasks = [
'view-contact',
'edit-contact',
'new-activity',
'group-add-contact',
'tag-contact',
'delete-contact',
- );
+ ];
$corePermission = CRM_Core_Permission::getPermission();
- $contextMenu = array();
+ $contextMenu = [];
foreach ($menu as $key => $values) {
- if ($key != 'otherActions') {
+ if ($key !== 'otherActions') {
// user does not have necessary permissions.
if (!self::checkUserMenuPermissions($aclPermissionedTasks, $corePermission, $values)) {
continue;
}
// build directly accessible action menu.
- if (in_array($values['ref'], array(
+ if (in_array($values['ref'], [
'view-contact',
'edit-contact',
- ))) {
- $contextMenu['primaryActions'][$key] = array(
+ ])) {
+ $contextMenu['primaryActions'][$key] = [
'title' => $values['title'],
'ref' => $values['ref'],
'class' => CRM_Utils_Array::value('class', $values),
'key' => $values['key'],
- );
+ ];
continue;
}
// finally get menu item for -more- action widget.
- $contextMenu['moreActions'][$values['weight']] = array(
+ $contextMenu['moreActions'][$values['weight']] = [
'title' => $values['title'],
'ref' => $values['ref'],
'href' => CRM_Utils_Array::value('href', $values),
'tab' => CRM_Utils_Array::value('tab', $values),
'class' => CRM_Utils_Array::value('class', $values),
'key' => $values['key'],
- );
+ ];
}
else {
foreach ($values as $value) {
}
// finally get menu item for -more- action widget.
- $contextMenu['otherActions'][$value['weight']] = array(
+ $contextMenu['otherActions'][$value['weight']] = [
'title' => $value['title'],
'ref' => $value['ref'],
'href' => CRM_Utils_Array::value('href', $value),
'class' => CRM_Utils_Array::value('class', $value),
'icon' => CRM_Utils_Array::value('icon', $value),
'key' => $value['key'],
- );
+ ];
}
}
}
}
// if still user does not have required permissions, check acl.
- if (!$hasAllPermissions && $menuOptions['ref'] != 'delete-contact') {
+ if (!$hasAllPermissions && $menuOptions['ref'] !== 'delete-contact') {
if (in_array($menuOptions['ref'], $aclPermissionedTasks) &&
- $corePermission == CRM_Core_Permission::EDIT
- ) {
+ $corePermission == CRM_Core_Permission::EDIT
+ ) {
$hasAllPermissions = TRUE;
}
- elseif (in_array($menuOptions['ref'], array(
+ elseif (in_array($menuOptions['ref'], [
'new-email',
- ))) {
+ ])) {
// grant permissions for these tasks.
$hasAllPermissions = TRUE;
}
'SELECT created_date, modified_date
FROM civicrm_contact
WHERE id = %1',
- array(
- 1 => array($contactId, 'Integer'),
- )
+ [
+ 1 => [$contactId, 'Integer'],
+ ]
);
if ($timestamps->fetch()) {
- return array(
+ return [
'created_date' => $timestamps->created_date,
'modified_date' => $timestamps->modified_date,
- );
+ ];
}
else {
return NULL;
/**
* Get a list of triggers for the contact table.
*
- * @see hook_civicrm_triggerInfo
- * @see CRM_Core_DAO::triggerRebuild
- * @see http://issues.civicrm.org/jira/browse/CRM-10554
- *
* @param $info
* @param null $tableName
+ *
+ * @see http://issues.civicrm.org/jira/browse/CRM-10554
+ *
+ * @see hook_civicrm_triggerInfo
+ * @see CRM_Core_DAO::triggerRebuild
*/
public static function triggerInfo(&$info, $tableName = NULL) {
//during upgrade, first check for valid version and then create triggers
// Modifications to these records should update the contact timestamps.
\Civi\Core\SqlTrigger\TimestampTriggers::create('civicrm_contact', 'Contact')
- ->setRelations(array(
- array('table' => 'civicrm_address', 'column' => 'contact_id'),
- array('table' => 'civicrm_email', 'column' => 'contact_id'),
- array('table' => 'civicrm_im', 'column' => 'contact_id'),
- array('table' => 'civicrm_phone', 'column' => 'contact_id'),
- array('table' => 'civicrm_website', 'column' => 'contact_id'),
- ))
+ ->setRelations([
+ ['table' => 'civicrm_address', 'column' => 'contact_id'],
+ ['table' => 'civicrm_email', 'column' => 'contact_id'],
+ ['table' => 'civicrm_im', 'column' => 'contact_id'],
+ ['table' => 'civicrm_phone', 'column' => 'contact_id'],
+ ['table' => 'civicrm_website', 'column' => 'contact_id'],
+ ])
->alterTriggerInfo($info, $tableName);
// Update phone table to populate phone_numeric field
$sqlTriggers = Civi::service('sql_triggers');
$sqlTriggers->enqueueQuery(self::DROP_STRIP_FUNCTION_43);
$sqlTriggers->enqueueQuery(self::CREATE_STRIP_FUNCTION_43);
- $info[] = array(
- 'table' => array('civicrm_phone'),
+ $info[] = [
+ 'table' => ['civicrm_phone'],
'when' => 'BEFORE',
- 'event' => array('INSERT', 'UPDATE'),
+ 'event' => ['INSERT', 'UPDATE'],
'sql' => "\nSET NEW.phone_numeric = civicrm_strip_non_numeric(NEW.phone);\n",
- );
+ ];
}
}
/**
* Get options for a given contact field.
*
- * @see CRM_Core_DAO::buildOptions
- *
- * TODO: Should we always assume chainselect? What fn should be responsible for controlling that flow?
- * TODO: In context of chainselect, what to return if e.g. a country has no states?
- *
* @param string $fieldName
* @param string $context
- * @see CRM_Core_DAO::buildOptionsContext
* @param array $props
* whatever is known about this dao object.
*
* @return array|bool
+ * @see CRM_Core_DAO::buildOptions
+ *
+ * TODO: Should we always assume chainselect? What fn should be responsible for controlling that flow?
+ * TODO: In context of chainselect, what to return if e.g. a country has no states?
+ *
+ * @see CRM_Core_DAO::buildOptionsContext
*/
- public static function buildOptions($fieldName, $context = NULL, $props = array()) {
- $params = array();
+ public static function buildOptions($fieldName, $context = NULL, $props = []) {
+ $params = [];
// Special logic for fields whose options depend on context or properties
switch ($fieldName) {
case 'contact_sub_type':
*
* @param string $type
* @param int $id
+ *
* @return bool
*/
public static function deleteObjectWithPrimary($type, $id) {
public function addSelectWhereClause() {
// We always return an array with these keys, even if they are empty,
// because this tells the query builder that we have considered these fields for acls
- $clauses = array(
+ $clauses = [
'id' => (array) CRM_Contact_BAO_Contact_Permission::cacheSubquery(),
- 'is_deleted' => CRM_Core_Permission::check('access deleted contacts') ? array() : array('!= 1'),
- );
+ 'is_deleted' => CRM_Core_Permission::check('access deleted contacts') ? [] : ['!= 1'],
+ ];
CRM_Utils_Hook::selectWhereClause($this, $clauses);
return $clauses;
}
];
foreach ($retrieved['values'] as $id => $profile) {
if (in_array($profile['name'], $profiles)) {
- $links[] = array(
+ $links[] = [
'label' => $profile['title'],
'url' => CRM_Utils_System::url('civicrm/profile/create', "reset=1&context=dialog&gid=$id",
NULL, NULL, FALSE, FALSE, TRUE),
'type' => ucfirst(str_replace('new_', '', $profile['name'])),
'icon' => CRM_Utils_Array::value(str_replace('new_', '', $profile['name']), $icons),
- );
+ ];
}
else {
$append[] = $id;