URLs for links passed into filter, send usable data for textSearch and list queries
authorLaury GvR <laury@gaslightmedia.com>
Thu, 20 Sep 2018 15:35:48 +0000 (11:35 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Thu, 20 Sep 2018 15:35:51 +0000 (11:35 -0400)
setup/adminHooks.php

index 3b76050..3566ac4 100644 (file)
@@ -43,40 +43,36 @@ add_filter('glm-member-db-admin-management-hooksHelp', function($content) {
     10,
     2
 );
+
 add_filter(
     GLM_MEMBERS_PACKAGING_PLUGIN_SLUG .'-dashboard-widget',
     function ( $member = null ) {
-        //$content = GLM_MEMBERS_PACKAGING_PLUGIN_SLUG;
+        $packagingIndexPage = GLM_MEMBERS_PACKAGING_PLUGIN_ADMIN_URL . '?page=glm-members-admin-menu-packaging-index&glm_action=index';
+        $packagesTable = GLM_MEMBERS_PACKAGING_PLUGIN_DB_PREFIX . "packages";
         $content = [
             'title' => 'Packaging',
             'buttons' => [
                 'order' => -1,
-                'type' => 'buttons',
+                'component' => 'buttons',
                 'buttons' => [
                     'add-package' => [
                         'content' => 'Add Package',
-                        'url' => '#AP',
+                        'url' => $packagingIndexPage . "&option=add",
                         'classes' => '',
                     ],
-                    'second-button' => [
-                        'content' => 'Do Other Stuff',
-                        'url' => '#DOS',
-                        'classes' => '',
-                        'styles' => 'top: 50px;',
-                    ]
                 ],
             ],
             'quickLinks' => [
                 'order' => 0,
-                'type' => 'quickLinks',
+                'component' => 'quickLinks',
                 'quickLinks' => [
                     'dashboard' => [
                         'content' => 'Dashboard',
-                        'url' => '#dbd',
+                        'url' => $packagingIndexPage . "&option=dashboard",
                     ],
                     'search' => [
                         'content' => 'Advanced Search',
-                        'url' => '#DOS',
+                        'url' => $packagingIndexPage . "&option=search",
                     ],
                     'settings' => [
                         'content' => 'Settings',
@@ -86,13 +82,14 @@ add_filter(
             ],
             'entityAmount' => [
                 'order' => 1,
-                'type' => 'entityAmount',
-                'table' => GLM_MEMBERS_PACKAGING_PLUGIN_DB_PREFIX."packages",
+                'component' => 'entityAmount',
+                'table' => $packagesTable,
+                'url' => $packagingIndexPage . "&option=search",
             ],
             'textSearch' => [
                 'order' => 2,
-                'type' => 'textSearch',
-                'table' => GLM_MEMBERS_PACKAGING_PLUGIN_DB_PREFIX."packages",
+                'component' => 'textSearch',
+                'table' => $packagesTable,
                 'fields' => [
                     'id',
                     'title',
@@ -101,23 +98,26 @@ add_filter(
                 ]
             ],
             'pending' => [
+                'title' => "Pending Packages",
+                'slug' => "pending-packages",
                 'order' => 3,
-                'type' => 'list',
-                'table' => GLM_MEMBERS_PACKAGING_PLUGIN_DB_PREFIX."packages",
-                'fields' => [
-                    'id',
-                    'title',
-                ],
-                'where' => 'status = '.$this->config['status_numb']['Pending']
+                'component' => 'list',
+                'table' => $packagesTable,
+                'fields' => "id, title, ref_dest",
+                'where' => 'status = '.$this->config['status_numb']['Pending'],
             ],
             'expired' => [
+                'title' => "Expired Packages",
+                'slug' => "expired-packages",
                 'order' => 4,
-                'type' => 'list',
-                'table' => GLM_MEMBERS_PACKAGING_PLUGIN_DB_PREFIX."packages",
-                'fields' => [
-                    'id',
-                    'title',
-                ],
+                'component' => 'list',
+                'table' => $packagesTable,
+                'fields' => "id, title, ref_dest",
+                // 'fields' => [
+                //     'id',
+                //     'title',
+                //     'ref_dest',
+                // ],
                 //'where' => 'status = '.$this->config['status_numb']['Expired']
             ]
         ];