|
1
|
|
|
<?php |
|
2
|
|
|
namespace DummyPress\Views; |
|
3
|
|
|
use DummyPress\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 Mike Selander |
|
12
|
|
|
*/ |
|
13
|
|
|
class Terms extends Abs\View { |
|
14
|
|
|
|
|
15
|
|
|
public function __construct() { |
|
16
|
|
|
|
|
17
|
|
|
$this->title = __( 'Terms', 'dummybot' ); |
|
18
|
|
|
$this->type = 'term'; |
|
19
|
|
|
$this->priority = 2; |
|
20
|
|
|
|
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Our sections action block - button to create and delete. |
|
26
|
|
|
* |
|
27
|
|
|
* @access protected |
|
28
|
|
|
* |
|
29
|
|
|
* @return string HTML content. |
|
30
|
|
|
*/ |
|
31
|
|
|
protected function actions_section() { |
|
32
|
|
|
$html = ''; |
|
33
|
|
|
|
|
34
|
|
|
$taxonomies = get_taxonomies(); |
|
35
|
|
|
|
|
36
|
|
|
foreach ( $taxonomies as $tax ) : |
|
37
|
|
|
|
|
38
|
|
|
$skipped_taxonomies = array( |
|
39
|
|
|
'post_format', // We shouldn't be making random post format classes |
|
40
|
|
|
'product_shipping_class', // These aren't used visually and are therefore skipped |
|
41
|
|
|
'nav_menu', // Menus are handled seperately of taxonomies |
|
42
|
|
|
); |
|
43
|
|
|
|
|
44
|
|
|
// Skip banned taxonomies |
|
45
|
|
|
if ( in_array( $tax, $skipped_taxonomies ) ) { |
|
46
|
|
|
continue; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
$taxonomy = get_taxonomy( $tax ); |
|
50
|
|
|
|
|
51
|
|
|
$html .= "<div class='test-data-cpt'>"; |
|
52
|
|
|
|
|
53
|
|
|
$html .= "<h3>"; |
|
54
|
|
|
|
|
55
|
|
|
$html .= "<span class='label'>" . esc_html( $taxonomy->labels->name ) . "</span>"; |
|
56
|
|
|
|
|
57
|
|
|
$html .= $this->build_button( 'create', $tax, __( 'Create', 'dummybot' ) . " " . $taxonomy->labels->name ); |
|
58
|
|
|
$html .= $this->build_button( 'delete', $tax, __( 'Delete', 'dummybot' ) . " " . $taxonomy->labels->name ); |
|
59
|
|
|
|
|
60
|
|
|
$html .= "</h3>"; |
|
61
|
|
|
|
|
62
|
|
|
$html .= "</div>"; |
|
63
|
|
|
|
|
64
|
|
|
endforeach; |
|
65
|
|
|
|
|
66
|
|
|
return $html; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
} |
|
70
|
|
|
|