Started adding some documentation to the admin hooks and started building the hooksHe...
authorChuck Scott <cscott@gaslightmedia.com>
Mon, 13 Nov 2017 18:38:25 +0000 (13:38 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Mon, 13 Nov 2017 18:38:25 +0000 (13:38 -0500)
setup/adminHooks.php
setup/hooksHelp.html

index f82fb26..24edd4a 100644 (file)
  *
  *  Also note that parameters will be in the context of the main admin controller constructor.
   */
+
+// Add hooksHelp.html file to admin Management hooks output
+add_filter('glm-member-db-admin-management-hooksHelp', function($content) {
+
+    // Read in this plugin/addon hook help file
+    $fname = GLM_MEMBERS_FIELDS_PLUGIN_PATH.'/setup/hooksHelp.html';
+    if (is_file($fname)) {
+        $hooksHelp = file_get_contents($fname);
+        if ($hooksHelp != false) {
+            $content .= $hooksHelp;
+        }
+    }
+    return $content;
+},
+10,
+2
+);
+
 /**
  * Filter will return true if the plugin is active.
  */
 add_filter( 'glm-members-customfields-active', function( $active ){
     return true;
 }, 10, 1 );
+
 /**
- * Filter returns html from the management -> fields model.   
+ * Filter returns html from the management -> fields model.
  */
 add_filter( 'glm-members-customfields-edit', function( $content, $uid ){
     unset( $_REQUEST['glm_action'] );
-    $content = $this->controller( 'management', 'fields', array( 'uid' => $uid ), true );
+    $content .= $this->controller( 'management', 'fields', array( 'uid' => $uid ), true );
     return $content;
 }, 10, 2 );
+
 /**
  * Filter returns the html for the form segment
  */
 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);
+    $content .= $this->controller( 'entity', 'fields', array( 'uid' => $uid, 'entityID' => $id,'cfData'=>$cfData ), true);
     return $content;
 }, 10, 4 );
+
 /**
  * Filter Captured Data Success Status
  *
@@ -56,22 +77,34 @@ add_filter( 'glm-members-custom-fields-form', function( $content, $uid, $id,$cfD
 add_filter( 'glm-members-customfields-capture', function( $content, $uid, $id ){
 
 }, 10, 3 );
+
 /**
  * Filter to Return Stored Data
  */
 add_filter( 'glm-members-customfields-data', function( $content, $uid, $id ){
 
 }, 10, 3 );
+
+/**
+ * Filter to Return a tab link for multi-page sub-tabs.
+ */
 add_filter( 'glm-member-db-custom-fields-nav', function( $content, $tableName ){
-    $out = '<a id="glm-custom-fields" data-show-table="glm-table-custom-fields" class="glm-'.$tableName .'-tab nav-tab">Custom Fields</a>';
+    $out .= '<a id="glm-custom-fields" data-show-table="glm-table-custom-fields" class="glm-'.$tableName .'-tab nav-tab">Custom Fields</a>';
     return $out;
 },10,2);
 
+/**
+ *  ?????????
+ */
 add_filter( 'glm-member-db-custom-fields-tab', function( $content, $entityID = '' ){
     unset( $_REQUEST['glm_action'] );
     $content = $this->controller( 'fields', 'fields', $entityID );
     return $content;
 },1,2);
+
+/**
+ * ?????????
+ */
 add_filter( 'glm-member-db-custom-filter-search', function ( $content ) {
 $parts = array();
     $customFields = $this->wpdb->get_results(
@@ -109,6 +142,10 @@ $parts = array();
     }
     return implode( ' ', $parts );
 });
+
+/**
+ * ?????????
+ */
 add_filter('glm-member-db-admin-search-query', function() {
     $queryParts = array();
     // Get all custom fields
@@ -157,16 +194,24 @@ add_filter('glm-member-db-admin-search-query', function() {
     }
     return $queryParts;
 });
+
+/**
+ * ????????
+ */
 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);
-  
+
     },
     10,
     1
 );
+
+/**
+ * ????????
+ */
 add_action(
     'glm-member-db-clone-custom-fields',
     function( $entityID, $newId ){
index bbe0e75..8ba7a8c 100644 (file)
             </td>
         </tr>
 
--->
\ No newline at end of file
+-->
+
+<tr><th colspan="3" class="glm-notice"><p>Custom Fields Add-On</p></th></tr>
+<tr><th colspan="3">Menu/Tab Hooks</th></tr>
+<tr>
+    <td>glm-members-customfields-active</td>
+    <td>FILTER</td>
+    <td></td>
+    <td>
+        Returns TRUE if Custom Fields Add-On is installed and active.
+    </td>
+</tr>
+<tr>
+    <td>glm-member-db-custom-fields-nav</td>
+    <td>FILTER</td>
+    <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 
+        desire to put additional HTML code before the tab. The return will be HTML to
+        display a functional tab.
+        <p>
+            Note that such tabs will require the correct scripting to make them work as
+            is used for sub-tabs in our add-ons.
+        </p>
+    </td>
+</tr>
+<tr><th colspan="3">Fields Add/Delete/Edit</th></tr>
+<tr>
+    <td>glm-members-customfields-edit</td>
+    <td>FILTER</td>
+    <td>$content, $uid</td>
+    <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. 
+            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 
+            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
+            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> 
+    </td>
+</tr>
+<tr><th colspan="3">Fields Use</th></tr>
+<tr>
+    <td>glm-members-custom-fields-form</td>
+    <td>FILTER</td>
+    <td>$content, $uid, $id, $cfData</td>
+    <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. 
+            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 
+            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
+            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 
+            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 
+            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> 
+        <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 
+            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
+            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>