+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019 |
+ | Copyright CiviCRM LLC (c) 2004-2020 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2019
+ * @copyright CiviCRM LLC (c) 2004-2020
*/
/**
/**
* Maximum profile fields that will be displayed.
+ * @var int
*/
protected $_maxFields = 9;
/**
- * @var array Fields that belong to this UF Group
+ * Fields that belong to this UF Group.
+ *
+ * @var array
*/
protected $_fields;
- // Must be set to entity table name (eg. civicrm_participant) by child class
- static $tableName = NULL;
- // Must be set to entity shortname (eg. event)
- static $entityShortname = NULL;
+ /**
+ * Must be set to entity table name (eg. civicrm_participant) by child class
+ * @var string
+ */
+ public static $tableName = NULL;
+ /**
+ * Must be set to entity shortname (eg. event)
+ * @var string
+ */
+ public static $entityShortname = NULL;
/**
* Build all the data structures needed to build the form.
parent::preProcess();
// get the contact read only fields to display.
- $readOnlyFields = array_merge(array('sort_name' => ts('Name')),
+ $readOnlyFields = array_merge(['sort_name' => ts('Name')],
CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_autocomplete_options',
TRUE, NULL, FALSE, 'name', TRUE
if (!$ufGroupId) {
throw new InvalidArgumentException('ufGroupId is missing');
}
- $this->_title = ts("Update multiple %1s", array(1 => $this::$entityShortname)) . ' - ' . CRM_Core_BAO_UFGroup::getTitle($ufGroupId);
+ $this->_title = ts("Update multiple %1s", [1 => $this::$entityShortname]) . ' - ' . CRM_Core_BAO_UFGroup::getTitle($ufGroupId);
CRM_Utils_System::setTitle($this->_title);
$this->addDefaultButtons(ts('Save'));
// remove file type field and then limit fields
$suppressFields = FALSE;
- $removeHtmlTypes = array('File');
+ $removeHtmlTypes = ['File'];
foreach ($this->_fields as $name => $field) {
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name) &&
in_array($this->_fields[$name]['html_type'], $removeHtmlTypes)
$this->_fields = array_slice($this->_fields, 0, $this->_maxFields);
- $this->addButtons(array(
- array(
+ $this->addButtons([
+ [
'type' => 'submit',
- 'name' => ts('Update ' . ucfirst($this::$entityShortname) . 's)'),
+ 'name' => ts('Update'),
'isDefault' => TRUE,
- ),
- array(
+ ],
+ [
'type' => 'cancel',
'name' => ts('Cancel'),
- ),
- ));
+ ],
+ ]);
$this->assign('profileTitle', $this->_title);
$this->assign('componentIds', $this->_entityIds);
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
$customValue = CRM_Utils_Array::value($customFieldID, $customFields);
- $entityColumnValue = array();
+ $entityColumnValue = [];
if (!empty($customValue['extends_entity_column_value'])) {
$entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR,
$customValue['extends_entity_column_value']
// don't set the status message when form is submitted.
$buttonName = $this->controller->getButtonName('submit');
if ($suppressFields && $buttonName != '_qf_Batch_next') {
- CRM_Core_Session::setStatus(ts("File type field(s) in the selected profile are not supported for Update multiple %1s", array(1 => $this::$entityShortname)), ts('Unsupported Field Type'), 'error');
+ CRM_Core_Session::setStatus(ts("File type fields in the selected profile are not supported for Update multiple %1s", [1 => $this::$entityShortname]), ts('Unsupported Field Type'), 'error');
}
- $this->addDefaultButtons(ts('Update ' . ucfirst($this::$entityShortname) . 's'));
+ $this->addDefaultButtons(ts('Update'));
$taskComponent['lc'] = $this::$entityShortname;
$taskComponent['ucfirst'] = ucfirst($this::$entityShortname);
*/
public function setDefaultValues() {
if (empty($this->_fields)) {
- return array();
+ return [];
}
- $defaults = array();
+ $defaults = [];
foreach ($this->_entityIds as $entityId) {
CRM_Core_BAO_UFGroup::setProfileDefaults(NULL, $this->_fields, $defaults, FALSE, $entityId, ucfirst($this::$entityShortname));
}