From 7091f75c5cf685b79309e75fb319f86204ccd938 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Wed, 17 Apr 2019 13:20:25 -0400 Subject: [PATCH] organizing categories for the shortcode builder by the parent child and styling them so they are discernible --- models/admin/pages/shortcode.php | 12 +++++++++++- views/admin/pages/shortcode.html | 19 ++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/models/admin/pages/shortcode.php b/models/admin/pages/shortcode.php index 675c1053..746be424 100644 --- a/models/admin/pages/shortcode.php +++ b/models/admin/pages/shortcode.php @@ -149,7 +149,17 @@ class GlmMembersAdmin_pages_shortcode $detailAttr = $this->config['addOns']['glm-member-db']['shortcodes']['glm-member-detail']['attributes']; $featuredAttr = $this->config['addOns']['glm-member-db']['shortcodes']['glm-member-featured']['attributes']; $glmcat = new GlmDataCategories( $this->wpdb, $this->config ); - $categories = $glmcat->getList('', 'T.name'); + // $categories = $glmcat->getList('', 'T.name'); + $cats = $glmcat->getListSortedParentChild(); + $categories = []; + foreach($cats as $cat){ + if( !$cat['parent']['value'] ){ + $cat['class'] = "glma-category-parent"; + }else{ + $cat['class'] = "glma-category-child"; + } + $categories[$cat['id']] = $cat; + } // get the each addOn slugs to pass to the config array later $addOns = $this->config['addOns']; diff --git a/views/admin/pages/shortcode.html b/views/admin/pages/shortcode.html index 22761005..f6028457 100644 --- a/views/admin/pages/shortcode.html +++ b/views/admin/pages/shortcode.html @@ -9,7 +9,12 @@