organizing categories for the shortcode builder by the parent child and styling them...
authorAnthony Talarico <talarico@gaslightmedia.com>
Wed, 17 Apr 2019 17:20:25 +0000 (13:20 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Wed, 17 Apr 2019 17:20:25 +0000 (13:20 -0400)
models/admin/pages/shortcode.php
views/admin/pages/shortcode.html

index 675c105..746be42 100644 (file)
@@ -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'];
index 2276100..f602845 100644 (file)
@@ -9,7 +9,12 @@
         <select id="shortcode-categories" class="shortcode-selection" data-type="categories">
             <option disabled selected> Select Category </option>
             {foreach $categories as $key => $value}
-                <option data-type="categories" value="{$key}">{$value.name}</option>
+                <option class="{$value.class}" data-type="categories" value="{$key}">
+                    {if $value.class == 'glma-category-child'}
+                        &nbsp;&nbsp;&nbsp;
+                    {/if}
+                    {$value.name}
+                </option>
             {/foreach}
         </select>
         <select id="shortcode-blankstart" class="shortcode-selection" data-type="blankstart">
 </div>
 
 
+<style>
+    .glma-category-parent{
+        font-weight: bold;
+    }
+    .glma-category-child{
+        font-style:italic;
+        padding-left: 10px;
+    }
+    .glma-category-child::before{
+        content: "-";
+    }
+</style>
\ No newline at end of file