Conditions | 3 |
Paths | 3 |
Total Lines | 33 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
30 | protected function actions_section() { |
||
31 | $html = ''; |
||
32 | |||
33 | // Loop through every post type available on the site |
||
34 | $post_types = get_post_types( array( 'public' => true ), 'objects' ); |
||
35 | |||
36 | foreach ( $post_types as $post_type ) : |
||
37 | |||
38 | $skipped_cpts = array( |
||
39 | 'attachment' |
||
40 | ); |
||
41 | |||
42 | // Skip banned cpts |
||
43 | if ( in_array( $post_type->name, $skipped_cpts ) ) { |
||
44 | continue; |
||
45 | } |
||
46 | |||
47 | $html .= "<div class='test-data-cpt'>"; |
||
48 | |||
49 | $html .= "<h3>"; |
||
50 | |||
51 | $html .= "<span class='label'>" . esc_html( $post_type->labels->name ) . "</span>"; |
||
52 | $html .= $this->build_button( 'create', $post_type->name, __( 'Create Test Data', 'dummybot' ) ); |
||
53 | $html .= $this->build_button( 'delete', $post_type->name, __( 'Delete Test Data', 'dummybot' ) ); |
||
54 | |||
55 | $html .= "</h3>"; |
||
56 | |||
57 | $html .= "</div>"; |
||
58 | |||
59 | endforeach; |
||
60 | |||
61 | return $html; |
||
62 | } |
||
63 | |||
65 |