Notes for groups
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 12 Apr 2019 20:52:16 +0000 (16:52 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 12 Apr 2019 20:52:16 +0000 (16:52 -0400)
Docs for the group functions for resetting the fields array.
Not completely working correctly.

classes/data/settings/dataSettingsGeneral.php
lib/GlmDataAbstract/DataAbstract.php

index 85b6280..a4ee145 100755 (executable)
@@ -75,6 +75,8 @@ class GlmDataSettingsGeneral extends GlmDataAbstract
      */
     public $fields = false;
 
+    public $groupSelect = false;
+
     /**
      * Constructor
      *
index 00162c4..f931a5f 100755 (executable)
@@ -3724,6 +3724,7 @@ $forEdit = true;
      */
     public function updateEntry($id, $idField = 'id', $store = true, $fieldPrefix = '')
     {
+        $this->selectGroupFields();
 
         // Store any input field prefix
         $this->fieldPrefix = $fieldPrefix;
@@ -3795,6 +3796,7 @@ $forEdit = true;
 
         }
 
+        $this->restoreFields();
         return $r;
 
     }
@@ -4210,6 +4212,7 @@ $forEdit = true;
     public function selectGroupFields()
     {
         if ( $this->groupSelect && is_array( $this->groupSelect ) && !empty( $this->groupSelect ) ) {
+            // Clean the array of fields
             $this->saveFields = $this->fields;
             $this->fields     = false;
 
@@ -4219,10 +4222,10 @@ $forEdit = true;
             foreach ( $this->groupSelect as $groupSelected ) {
                 // Find the group
                 if ( isset( $this->groups[$groupSelected] ) && $this->groups[$groupSelected] ) {
-                    trigger_error( print_r( $this->groups[$groupSelected], true ), E_USER_NOTICE );
+                    // trigger_error( print_r( $this->groups[$groupSelected], true ), E_USER_NOTICE );
                     if ( isset( $this->groups[$groupSelected]['fields'] ) && is_array( $this->groups[$groupSelected]['fields'] ) ) {
                         foreach ( $this->groups[$groupSelected]['fields'] as $fieldKey => $field ) {
-                            trigger_error( print_r( $field, true ), E_USER_NOTICE );
+                            // trigger_error( print_r( $field, true ), E_USER_NOTICE );
                             $this->fields[] = $this->saveFields[$field['name']];
                         }
                     }
@@ -4234,6 +4237,6 @@ $forEdit = true;
     public function restoreFields()
     {
         $this->fields     = $this->saveFields;
-        $this->saveFields = false;
+        // $this->saveFields = false;
     }
 }