Passed
Push — dev/6.0.0 ( f03c64...a274a9 )
by Sudar
03:13
created

Renderer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 27
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
	/**
18
	 * Render Post Types as radio buttons.
19
	 */
20
	protected function render_post_type_as_radios() {
21
		$field_slug = $this->field_slug;
22
23
		$post_types = bd_get_post_type_objects();
24
		?>
25
26
		<?php foreach ( $post_types as $post_type ) : ?>
27
28
			<tr>
29
				<td scope="row">
30
					<input type="radio" name="<?php echo esc_attr( $field_slug ); ?>_post_type"
31
						value="<?php echo esc_attr( $post_type->name ); ?>"
32
						id="smbd_post_type_<?php echo esc_html( $post_type->name ); ?>">
33
34
					<label for="smbd_post_type_<?php echo esc_html( $post_type->name ); ?>">
35
						<?php echo esc_html( $post_type->label ); ?>
36
					</label>
37
				</td>
38
			</tr>
39
40
		<?php endforeach; ?>
41
		<?php
42
	}
43
}
44