Update docs for admin hooks.
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 7 Dec 2017 13:45:27 +0000 (08:45 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 7 Dec 2017 13:45:27 +0000 (08:45 -0500)
Writing the documentation for the admin hooks that were originally in
the custom field plugin.

models/admin/entity/fields.php
models/admin/management/fields.php
setup/adminHooks.php
setup/hooksHelp.html

index dd77474..bdbd46f 100644 (file)
@@ -120,8 +120,8 @@ class GlmMembersAdmin_entity_fields extends GlmDataFieldsCustomFields
         $customFields     = false;
         $haveCustomFields = false;
         $customFieldData  = false;
-        $where = 'true';
-        $uid = '';
+        $where            = 'true';
+        $uid              = '';
 
         if (isset($_REQUEST['option'])) {
             $option = $_REQUEST['option'];
@@ -138,8 +138,8 @@ class GlmMembersAdmin_entity_fields extends GlmDataFieldsCustomFields
             $uid = $actionData['uid'];
             $fieldFail = $actionData['cfData'];
 //            print_r($fieldFail);
-        }  
-        
+        }
+
         switch ($option) {
 
             default:
@@ -164,7 +164,7 @@ class GlmMembersAdmin_entity_fields extends GlmDataFieldsCustomFields
         }else {
             $customFieldsData = customFieldsGetFieldData( $entityID );
         }
-        
+
 
         // Compile template data
         $template_data = array(
index e3ed2b7..39dfdca 100644 (file)
@@ -138,9 +138,9 @@ class GlmMembersAdmin_management_fields extends GlmDataFieldsCustomFields
         if (isset($_REQUEST['id'])) {
             $id = $_REQUEST['id']-0;
         }
-        
+
         $uid = 0;
-        
+
         if (isset($actionData['uid'])) {
             $uid = $actionData['uid'];
         }
index b013323..599ce85 100644 (file)
@@ -62,7 +62,7 @@ add_filter( 'glm-members-customfields-edit', function( $content, $uid ){
 /**
  * Filter returns the html for the form segment
  */
-add_filter( 'glm-members-custom-fields-form', function( $content, $uid, $id,$cfData = false ){
+add_filter( 'glm-members-custom-fields-form', function( $content, $uid, $id, $cfData = false ){
     unset( $_REQUEST['glm_action'] );
     // echo "CONTENT: " .  $content . " UID: " . $uid . " ID: " . $id . '<br>';
     $content .= $this->controller( 'entity', 'fields', array( 'uid' => $uid, 'entityID' => $id,'cfData'=>$cfData ), true);
@@ -144,7 +144,7 @@ $parts = array();
 });
 
 /**
- * Front End Query Hook for searching member by custom fields
+ * Admin Query Hook for searching member by custom fields
  */
 add_filter('glm-member-db-admin-search-query', function() {
     $queryParts = array();
@@ -200,11 +200,11 @@ add_filter('glm-member-db-admin-search-query', function() {
  * Returns true if successful
  * Returns failure array if something goes wrong.
  */
-add_filter('glm-member-db-save-custom-fields', function( $entityID) {
+add_filter('glm-member-db-save-custom-fields', function( $entityId) {
     require_once GLM_MEMBERS_FIELDS_PLUGIN_CLASS_PATH . '/customFieldPluginSupport.php';
     // this will save the member data
     //echo "uid = $uid";
-    return customFieldsSaveFields( $entityID);
+    return customFieldsSaveFields( $entityI);
 
     },
     10,
@@ -218,10 +218,10 @@ add_filter('glm-member-db-save-custom-fields', function( $entityID) {
  */
 add_action(
     'glm-member-db-clone-custom-fields',
-    function( $entityID, $newId ){
+    function( $entityId, $newId ){
         require_once GLM_MEMBERS_FIELDS_PLUGIN_CLASS_PATH . '/customFieldPluginSupport.php';
         // this will clone the custom fields data
-        customFieldsCloneFields( $entityID, $newId );
+        customFieldsCloneFields( $entityId, $newId );
     },
     1,
     2
index 8ba7a8c..2f8fb78 100644 (file)
@@ -1,9 +1,9 @@
 <!-- Hooks Help for {descrName} with Example
 
         <tr><th colspan="3" class="glm-notice"><p>Sample Add-On</p></th></tr>
-        
+
         <tr><th colspan="3">User Permission Hooks</td></tr>
-        
+
         <tr>
             <td>some_hook_name</td>
             <td>FILTER or ACTION</td>
@@ -31,7 +31,7 @@
     <td>$content, $tableName</td>
     <td>
         Displays a tab to use for customer fields and will select the $tableName for display
-        when clicked. The $content parameter should be an empty string unless there is a 
+        when clicked. The $content parameter should be an empty string unless there is a
         desire to put additional HTML code before the tab. The return will be HTML to
         display a functional tab.
         <p>
     <td>
         Return HTML for field add/delete/edit for the specified form ($uid).
         <p>
-            The $content parameter should be an empty string when this filter is applied. 
+            The $content parameter should be an empty string when this filter is applied.
             Any HTML returned from this filter will be appended to the supplied text.
-            If desired, HTML code may be provided to be included at the beginning of the 
+            If desired, HTML code may be provided to be included at the beginning of the
             resulting string that's returned.
         </p>
         <p>
-            The $uid parameter is a text string that is a unique identifier for the the form that is to
+            The $uid parameter is a text string that is a unique identifier for the form that is to
             be edited. This should include the slug of the plugin that is calling
             for this form and a name or other identifier for the specific form. This might
             typically be specified in the form of a slug with hyphens between the words.
-        </p> 
+        </p>
     </td>
 </tr>
 <tr><th colspan="3">Fields Use</th></tr>
     <td>
         Displays a specific custom fields from to request user input.
         <p>
-            The $content parameter should be an empty string when this filter is applied. 
+            The $content parameter should be an empty string when this filter is applied.
             Any HTML returned from this filter will be appended to the supplied text.
-            If desired, HTML code may be provided to be included at the beginning of the 
+            If desired, HTML code may be provided to be included at the beginning of the
             resulting string that's returned.
         </p>
         <p>
-            The $uid parameter is a text string that is a unique identifier for the the form that is to
+            The $uid parameter is a text string that is a unique identifier for the form that is to
             be edited. This should include the slug of the plugin that is calling
             for this form and a name or other identifier for the specific form. This might
             typically be specified in the form of a slug with hyphens between the words.
         </p>
         <p>
-            The $id parameter is an INTEGER that is unique to this specific use of the form 
+            The $id parameter is an INTEGER that is unique to this specific use of the form
             specified by $uid. For example, if $uid points to a form with added fields to
-            be used along with the usual fields in a contact information form, the $id 
+            be used along with the usual fields in a contact information form, the $id
             parameter might be the 'id' field from the record containing the contact that's
             being edited. Any results submitted will be stored along with this $id. If
             this $uid and $id pair are used anywhere else, data submitted there will replace
-            the other uses of the same form and id. 
-        </p> 
+            the other uses of the same form and id.
+        </p>
         <p>
             The $cfData field is an array that contains field data to use as the default
-            when the form is displayed. This will usually come from a previous submission 
+            when the form is displayed. This will usually come from a previous submission
             of the form that failed due to a missing required field or other failure. This
             permit re-displaying the form again with the data in it that the user attempted
-            to subit. The $cfData may also have information that will be used by the custom
+            to submit. The $cfData may also have information that will be used by the custom
             fields add-on to format failed fields differently to show which need attention.
             If This is an initial display of the form, simply provide FALSE. ??????
         </p>
     </td>
 </tr>
+<tr>
+    <td>glm-member-db-custom-filter-search</td>
+    <td>Filter</td>
+    <td>$content</td>
+    <td>
+        Admin member list filter for displaying filters for the custom fields.
+
+        <p>$content is not being used in this filter.</p>
+        <p>This filter returns the html for the custom field form for the admin list search.</p>
+    </td>
+</tr>
+<tr>
+    <td>glm-member-db-admin-search-query</td>
+    <td>Filter</td>
+    <td></td>
+    <td>
+        Admin Query Hook for searching member by custom fields.
+
+        <p>This filter returns an array $queryParts. $queryParts is used in the member admin list to filter
+        any items from the member list that were present in the glm-member-db-custom-filter-search form.</p>
+    </td>
+</tr>
+<tr>
+    <td>glm-member-db-save-custom-fields</td>
+    <td>Filter</td>
+    <td>$entityID</td>
+    <td>
+        Save the data for the Member Info Custom Fields.
+        <p>$entityID field is an INTEGER that is unique for the member_info record. This points to the related
+        member info record.</p>
+    </td>
+</tr>
+<tr>
+    <td>glm-member-db-clone-custom-fields</td>
+    <td>Action</td>
+    <td>$entityID, $newId</td>
+    <td>
+        Clones the custom fields data. Grabs the custom field data for an entity and setup those custom
+        fields for a new id. This is used when cloning the member info record.
+
+        <p>$entityID field is an INTEGER that is unique to the member_info record. This points to the related
+        member info record.</p>
+        <p>$newId field is an INTEGER that is unique to the cloned member_info record.</p>
+    </td>
+</tr>