Add docs for two methods
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 27 Aug 2019 12:51:47 +0000 (08:51 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 27 Aug 2019 12:51:47 +0000 (08:51 -0400)
Adding Documentation for the two methods setting and resetting the
groups.

lib/GlmDataAbstract/DataAbstract.php

index ca5a572..a02de45 100755 (executable)
@@ -3297,29 +3297,13 @@ $forEdit = true;
         ];
 
         $params = array_merge( $defaults, $config );
+        // echo '<pre>$params: ' . print_r( $params, true ) . '</pre>';
 
         // extract $params Array
         extract( $params );
 
         $this->selectGroupFields();
 
-        // For testing only
-        /*
-        echo "<p>getList():<br>
-            <table>
-                <tr><td>Where:</td><td>$where</td></tr>
-                <tr><td>Order:</td><td>$order</td></tr>
-                <tr><td>Field Vals:</td><td>$fieldVals</td></tr>
-                <tr><td>ID Field:</td><td>$idField</td></tr>
-                <tr><td>Start:</td><td>$start</td></tr>
-                <tr><td>Limit:</td><td>$limit</td></tr>
-                <tr><td>Prohibit List Options</td><td>$prohibitListOptions</td></tr>
-                <tr><td>Append Select</td><td>$appendSelect</td></tr>
-            </table>
-            </p>
-        ";
-        */
-
         $seed = false;
 
         // NOTE: $fieldVals not yet implemented
@@ -3442,6 +3426,7 @@ $forEdit = true;
         $list = $this->wpdb->get_results( $sql, ARRAY_A );
 
         if ( count( $list ) == 0 ) {
+            $this->restoreFields();
             return false;
         }
 
@@ -3473,6 +3458,7 @@ $forEdit = true;
                 $return['stats'] = $stats;
             }
 
+            $this->restoreFields();
             return $return;
         }
 
@@ -4301,6 +4287,13 @@ $forEdit = true;
     }
 
 
+    /**
+     * Modify the $this->fields array to a set of group fields.
+     *
+     * Group fields are setup using $groupSelect Array.
+     *
+     * @return void
+     */
     public function selectGroupFields()
     {
         if ( $this->groupSelect && is_array( $this->groupSelect ) && !empty( $this->groupSelect ) ) {
@@ -4327,6 +4320,13 @@ $forEdit = true;
         }
     }
 
+    /**
+     * Modify the $this->fields array back to its standard set of fields.
+     *
+     * Set the $this->fields to $this->saveFields
+     *
+     * @return void
+     */
     public function restoreFields()
     {
         if ( isset( $this->saveFields ) && is_array( $this->saveFields ) && !empty( $this->saveFields ) ) {