1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
<?php
class CMB2_Type_Taxonomy_Radio_Hierarchical extends CMB2_Type_Taxonomy_Radio {
protected $parent = 0;
public function render() {
return $this->rendered(
$this->types->radio( array(
'options' => $this->get_term_options(),
), 'taxonomy_radio_hierarchical' )
);
}
protected function list_term_input( $term, $saved_term ) {
$options = parent::list_term_input( $term, $saved_term );
$children = $this->build_children( $term, $saved_term );
if ( ! empty( $children ) ) {
$options .= $children;
}
return $options;
}
}