X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FForm%2FTag.php;h=38d94049adeff2fe4b95a9961456f9525622f0bb;hb=54744051dea726c2b1495f24fc1cf7ba7fa25e11;hp=0ff005ca959641d8a2dc1718210c412b20271c41;hpb=8910a001428a2fe164c92b6be859e02289ba0e56;p=civicrm-core.git diff --git a/CRM/Core/Form/Tag.php b/CRM/Core/Form/Tag.php index 0ff005ca95..38d94049ad 100644 --- a/CRM/Core/Form/Tag.php +++ b/CRM/Core/Form/Tag.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2019 | + | Copyright CiviCRM LLC (c) 2004-2020 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -28,7 +28,7 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2019 + * @copyright CiviCRM LLC (c) 2004-2020 */ /** @@ -58,7 +58,7 @@ class CRM_Core_Form_Tag { public static function buildQuickForm( &$form, $parentNames, $entityTable, $entityId = NULL, $skipTagCreate = FALSE, $skipEntityAction = FALSE, $tagsetElementName = NULL) { - $tagset = $form->_entityTagValues = array(); + $tagset = $form->_entityTagValues = []; $form->assign("isTagset", FALSE); $mode = NULL; @@ -77,22 +77,22 @@ class CRM_Core_Form_Tag { } $tagset[$tagsetItem]['tagsetElementName'] = $tagsetElementName; - $form->addEntityRef("{$tagsetElementName}[{$parentId}]", $parentNameItem, array( - 'entity' => 'tag', + $form->addEntityRef("{$tagsetElementName}[{$parentId}]", $parentNameItem, [ + 'entity' => 'Tag', 'multiple' => TRUE, 'create' => !$skipTagCreate, - 'api' => array('params' => array('parent_id' => $parentId)), + 'api' => ['params' => ['parent_id' => $parentId]], 'data-entity_table' => $entityTable, 'data-entity_id' => $entityId, 'class' => "crm-$mode-tagset", - 'select' => array('minimumInputLength' => 0), - )); + 'select' => ['minimumInputLength' => 0], + ]); if ($entityId) { $tagset[$tagsetItem]['entityId'] = $entityId; $entityTags = CRM_Core_BAO_EntityTag::getChildEntityTags($parentId, $entityId, $entityTable); if ($entityTags) { - $form->setDefaults(array("{$tagsetElementName}[{$parentId}]" => implode(',', array_keys($entityTags)))); + $form->setDefaults(["{$tagsetElementName}[{$parentId}]" => implode(',', array_keys($entityTags))]); } } else { @@ -109,7 +109,7 @@ class CRM_Core_Form_Tag { // Merge this tagset info with possibly existing info in the template $tagsetInfo = (array) $form->get_template_vars("tagsetInfo"); if (empty($tagsetInfo[$mode])) { - $tagsetInfo[$mode] = array(); + $tagsetInfo[$mode] = []; } $tagsetInfo[$mode] = array_merge($tagsetInfo[$mode], $tagset); $form->assign("tagsetInfo", $tagsetInfo); @@ -152,8 +152,8 @@ class CRM_Core_Form_Tag { // when form is submitted with tagset values below logic will work and in the case when all tags in a tagset // are deleted we will have to set $params[tagset id] = '' which is done by above logic foreach ($params as $parentId => $value) { - $newTagIds = array(); - $tagIds = array(); + $newTagIds = []; + $tagIds = []; if ($value) { $tagIds = explode(',', $value); @@ -178,7 +178,7 @@ class CRM_Core_Form_Tag { if (!empty($newTagIds)) { // New tag ids can be inserted directly into the db table. - $insertValues = array(); + $insertValues = []; foreach ($newTagIds as $tagId) { $insertValues[] = "( {$tagId}, {$entityId}, '{$entityTable}' ) "; }