PluginProbe
CSS & JavaScript Toolbox / 12.0.5
CSS & JavaScript Toolbox v12.0.5
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
css-javascript-toolbox / models / block / assignmentpanel / taxonomybase.php

taxonomybase.php in CSS & JavaScript Toolbox 12.0.5, at models/block/assignmentpanel/taxonomybase.php

59 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 */
5
6 /**
7 *
8 */
9 abstract class CJT_Models_Block_Assignmentpanel_Taxonomybase
10 extends CJT_Models_Block_Assignmentpanel_Wordpress {
11
12
13 /**
14 * put your comment there...
15 *
16 * @var mixed
17 */
18 protected $args = array(
19 'child_of' => 0,
20 'hide_empty' => false,
21 'hierarchical' => 1,
22 'include_last_update_time' => false,
23 'order' => 'DESC',
24 'orderby' => 'name',
25 'pad_counts' => false,
26 );
27
28 /**
29 * put your comment there...
30 *
31 * @param mixed $key
32 * @param mixed $item
33 */
34 protected function prepareItem($key, & $item) {
35 // Initialize.
36 $typeParams =& $this->getTypeParams();
37 $taxonomy = $typeParams['type'];
38 // COMMON names for 'ID' and 'TITLE'
39 $preItem['id'] = $item->term_id;
40 $preItem['title'] = $item->name;
41 $preItem['parent'] = $item->parent;
42 // Get taxonomy link.
43 $preItem['link'] = get_term_link($item, $taxonomy);
44 /// Flag if term has child terms!
45 // Query childs.
46 $args = $this->args;
47 $args['parent'] = $preItem['id'];
48 $args['hide_empty'] = false;
49 $args['fields'] = 'ids';
50 $args['number'] = 1;
51 $childTerms = get_terms($typeParams['type'], $args);
52 // Flag it!
53 $preItem['hasChilds'] = !empty($childTerms);
54 // Re-Reference.
55 $item = $preItem;
56 }
57
58 } // End class.
59