Completed
Push — 193-feature/delete-post-revisi... ( 4c008c...2cafa6 )
by Rajan
141:08 queued 137:21
created

Renderer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A render_post_type_as_radios() 0 22 2
1
<?php
2
3
namespace BulkWP\BulkDelete\Core\Base\Mixin;
4
5
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
6
7
/**
8
 * Container of all Render methods.
9
 *
10
 * Ideally this should be a Trait. Since Bulk Delete still supports PHP 5.3, this is implemented as a class.
11
 * Once the minimum requirement is increased to PHP 5.3, this will be changed into a Trait.
12
 *
13
 * @since 6.0.0
14
 */
15
abstract class Renderer extends Fetcher {
16
	/**
17
	 * Render Post Types as radio buttons.
18
	 */
19
	protected function render_post_type_as_radios() {
20
		$field_slug = $this->field_slug;
21
22
		$post_types = bd_get_post_type_objects();
23
		?>
24
25
		<?php foreach ( $post_types as $post_type ) : ?>
26
27
			<tr>
28
				<td scope="row">
29
					<input type="radio" name="<?php echo esc_attr( $field_slug ); ?>_post_type"
30
						value="<?php echo esc_attr( $post_type->name ); ?>"
31
						id="smbd_post_type_<?php echo esc_html( $post_type->name ); ?>">
32
33
					<label for="smbd_post_type_<?php echo esc_html( $post_type->name ); ?>">
34
						<?php echo esc_html( $post_type->label ); ?>
35
					</label>
36
				</td>
37
			</tr>
38
39
		<?php endforeach; ?>
40
		<?php
41
	}
42
}
43