CRM-13992 coding neccessary property values / configurable options required for tab...
[civicrm-core.git] / CRM / Custom / Form / Group.php
index 3b339f23642ba5da31c85c9e610375e5682156f8..c18e36da4de27ceac0254f40573a58a96c5b4115 100644 (file)
@@ -135,7 +135,7 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
       $errors['title'] = ts('Custom group \'%1\' already exists in Database.', array(1 => $title));
     }
 
-    if (CRM_Utils_Array::value(1, $fields['extends'])) {
+    if (!empty($fields['extends'][1])) {
       if (in_array('', $fields['extends'][1]) && count($fields['extends'][1]) > 1) {
         $errors['extends'] = ts("Cannot combine other option with 'Any'.");
       }
@@ -151,7 +151,7 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
       $self->assign('showStyle', TRUE);
     }
 
-    if (CRM_Utils_Array::value('is_multiple', $fields)) {
+    if (!empty($fields['is_multiple'])) {
         $self->assign('showMultiple', TRUE);
     }
 
@@ -243,7 +243,7 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
     $sel2['ParticipantRole'] = $participantRole;
     $sel2['ParticipantEventName'] = CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
     $sel2['ParticipantEventType'] = $eventType;
-        $sel2['Contribution']         = CRM_Contribute_PseudoConstant::financialType( );
+    $sel2['Contribution'] = CRM_Contribute_PseudoConstant::financialType();
     $sel2['Relationship'] = $allRelationshipType;
 
     $sel2['Individual'] = CRM_Contact_BAO_ContactType::subTypePairs('Individual', FALSE, NULL);
@@ -417,10 +417,14 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
       $defaults['is_active'] = $defaults['collapse_display'] = 1;
       $defaults['style'] = 'Inline';
     }
-    elseif (!CRM_Utils_Array::value('max_multiple', $defaults) && !$this->_isGroupEmpty) {
+    elseif (empty($defaults['max_multiple']) && !$this->_isGroupEmpty) {
       $this->assign('showMaxMultiple', FALSE);
     }
 
+    if (($this->_action & CRM_Core_Action::UPDATE) && $defaults['is_multiple']) {
+      $defaults['collapse_display'] = 0;
+    }
+
     if (isset($defaults['extends'])) {
       $extends = $defaults['extends'];
       unset($defaults['extends']);