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
|
|
|
|