Nest all components of the filter into a components hierarchy
authorLaury GvR <laury@gaslightmedia.com>
Thu, 20 Sep 2018 20:46:08 +0000 (16:46 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Thu, 20 Sep 2018 20:46:08 +0000 (16:46 -0400)
setup/adminHooks.php

index 937cfdf..ff2e0c7 100644 (file)
@@ -50,88 +50,96 @@ add_filter(
         $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";
         $packagingEditPage = GLM_MEMBERS_PLUGIN_ADMIN_MENU_URL_BASE.'member&glm_action=packaging&option=edit';
+
+        /*
+        * For list components: pass ref_type and ref_dest as part of the 'fields' string if you want to
+        * make these options part of the href of each <li> link
+        * 
+        */
+
         $content = [
             'title' => 'Packaging',
-            'buttons' => [
-                'order' => -1,
-                'component' => 'buttons',
+            'components' => [
                 'buttons' => [
-                    'add-package' => [
-                        'content' => 'Add Package',
-                        'url' => $packagingIndexPage . "&option=add",
-                        'classes' => '',
+                    'order' => -1,
+                    'template' => 'buttons',
+                    'buttons' => [
+                        'add-package' => [
+                            'content' => 'Add Package',
+                            'url' => $packagingIndexPage . "&option=add",
+                            'classes' => '',
+                        ],
                     ],
                 ],
-            ],
-            'quickLinks' => [
-                'order' => 0,
-                'component' => 'quickLinks',
                 'quickLinks' => [
-                    'dashboard' => [
-                        'content' => 'Dashboard',
-                        'url' => $packagingIndexPage . "&option=dashboard",
+                    'order' => 0,
+                    'template' => 'quickLinks',
+                    'quickLinks' => [
+                        'dashboard' => [
+                            'content' => 'Dashboard',
+                            'url' => $packagingIndexPage . "&option=dashboard",
+                        ],
+                        'search' => [
+                            'content' => 'Advanced Search',
+                            'url' => $packagingIndexPage . "&option=search",
+                        ],
+                        'settings' => [
+                            'content' => 'Settings',
+                            'url' => '#set',
+                        ]
                     ],
-                    'search' => [
-                        'content' => 'Advanced Search',
-                        'url' => $packagingIndexPage . "&option=search",
-                    ],
-                    'settings' => [
-                        'content' => 'Settings',
-                        'url' => '#set',
-                    ]
                 ],
-            ],
-            'entityAmount' => [
-                'order' => 1,
-                'component' => 'entityAmount',
-                'table' => $packagesTable,
-                'url' => $packagingIndexPage . "&option=search",
-            ],
-            'textSearch' => [
-                'order'     => 2,
-                'component' => 'textSearch',
-                'entityID'  => 'packageID',
-                'table'     => $packagesTable,
-                'fields'    => "id, title as name, image, ref_dest",
-                'where'     => 'title',
-                'resultUrl' => $packagingEditPage,
-            ],
-            'active' => [
-                'title' => "Active Packages",
-                'slug' => "active-packages",
-                'order' => 3,
-                'component' => 'list',
-                'entityID'  => 'packageID',
-                'table' => $packagesTable,
-                'fields' => "id, title, ref_type, ref_dest",
-                'where' => 'status='.$this->config['status_numb']['Active'],
-                'resultUrl' => $packagingEditPage,
-            ],
-            'pending' => [
-                'title' => "Pending Packages",
-                'slug' => "pending-packages",
-                'order' => 3,
-                'component' => 'list',
-                'entityID'  => 'packageID',
-                'table' => $packagesTable,
-                'fields' => "id, title, ref_type, ref_dest",
-                'where' => 'status='.$this->config['status_numb']['Pending'],
-                'resultUrl' => $packagingEditPage,
-            ],
-            'expired' => [
-                'title' => "Expired Packages",
-                'slug' => "expired-packages",
-                'order' => 4,
-                'component' => 'list',
-                'entityID'  => 'packageID',
-                'table' => $packagesTable,
-                'fields' => "id, title, ref_type, ref_dest",
-                // 'fields' => [
-                //     'id',
-                //     'title',
-                //     'ref_dest',
-                // ],
-                //'where' => 'status = '.$this->config['status_numb']['Expired']
+                'entityAmount' => [
+                    'order' => 1,
+                    'template' => 'entityAmount',
+                    'table' => $packagesTable,
+                    'url' => $packagingIndexPage . "&option=search",
+                ],
+                'textSearch' => [
+                    'order'     => 2,
+                    'template'  => 'textSearch',
+                    'entityID'  => 'packageID',
+                    'table'     => $packagesTable,
+                    'fields'    => "id, title as name, image",
+                    'resultUrl' => $packagingEditPage,
+                ],
+                'active' => [
+                    'title' => "Active Packages",
+                    'slug' => "active-packages",
+                    'order' => 5,
+                    'template' => 'list',
+                    'entityID'  => 'packageID',
+                    'table' => $packagesTable,
+                    'fields' => "id, title, ref_type, ref_dest",
+                    'where' => 'status='.$this->config['status_numb']['Active'],
+                    'resultUrl' => $packagingEditPage,
+                ],
+                'pending' => [
+                    'title' => "Pending Packages",
+                    'slug' => "pending-packages",
+                    'order' => 4,
+                    'template' => 'list',
+                    'entityID'  => 'packageID',
+                    'table' => $packagesTable,
+                    'fields' => "id, title, ref_type, ref_dest",
+                    'where' => 'status='.$this->config['status_numb']['Pending'],
+                    'resultUrl' => $packagingEditPage,
+                ],
+                'expired' => [
+                    'title' => "Expired Packages",
+                    'slug' => "expired-packages",
+                    'order' => 3,
+                    'template' => 'list',
+                    'entityID'  => 'packageID',
+                    'table' => $packagesTable,
+                    'fields' => "id, title, ref_type, ref_dest",
+                    // 'fields' => [
+                    //     'id',
+                    //     'title',
+                    //     'ref_dest',
+                    // ],
+                    //'where' => 'status = '.$this->config['status_numb']['Expired']
+                ],
             ]
         ];