Terms::actions_section()   B
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 37
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 3
eloc 20
c 2
b 1
f 0
nc 3
nop 0
dl 0
loc 37
rs 8.8571
1
<?php
2
namespace testContent\Views;
3
use testContent\Abstracts as Abs;
4
5
/**
6
 * Generate view for creating and deleting terms.
7
 *
8
 * @abstract
9
 * @package    WordPress
10
 * @subpackage Test Content
11
 * @author     Old Town Media
12
 */
13
class Terms extends Abs\View{
14
15
	protected $title	= 'Terms';
16
	protected $type		= 'term';
17
	protected $priority	= 2;
18
19
20
	/**
21
	 * Our sections action block - button to create and delete.
22
	 *
23
	 * @access protected
24
	 *
25
	 * @return string HTML content.
26
	 */
27
	protected function actions_section(){
28
		$html = '';
29
30
		$taxonomies = get_taxonomies();
31
32
		foreach ( $taxonomies as $tax ) :
33
34
			$skipped_taxonomies = array(
35
				'post_format',				// We shouldn't be making random post format classes
36
				'product_shipping_class',	// These aren't used visually and are therefore skipped
37
				'nav_menu',					// Menus are handled seperately of taxonomies
38
			);
39
40
			// Skip banned taxonomies
41
			if ( in_array( $tax, $skipped_taxonomies ) ){
42
				continue;
43
			}
44
45
			$taxonomy = get_taxonomy( $tax );
46
47
			$html .= "<div class='test-data-cpt'>";
48
49
				$html .= "<h3>";
50
51
				$html .= "<span class='label'>".$taxonomy->labels->name."</span>";
52
53
				$html .= $this->build_button( 'create', $tax, __( 'Create', 'otm-test-content' )." ".$taxonomy->labels->name );
54
				$html .= $this->build_button( 'delete', $tax, __( 'Delete', 'otm-test-content' )." ".$taxonomy->labels->name );
55
56
				$html .= "</h3>";
57
58
			$html .= "</div>";
59
60
		endforeach;
61
62
		return $html;
63
	}
64
65
}
66