CMB2_Display_Taxonomy_Radio

The Maps Builder CMB2 Display Taxonomy Radio class.

Defined (1)

The class is defined in the following location(s).

/vendor/wordimpress/maps-builder-core/includes/libraries/metabox/includes/CMB2_Field_Display.php  
  1. class CMB2_Display_Taxonomy_Radio extends CMB2_Field_Display { 
  2. /** 
  3. * Display single taxonomy value. 
  4. * @since 2.2.2 
  5. */ 
  6. protected function _display() { 
  7. $taxonomy = $this->field->args( 'taxonomy' ); 
  8. $field_type = new CMB2_Type_Taxonomy_Radio( new CMB2_Types( $this->field ) ); 
  9. $terms = $field_type->get_object_terms(); 
  10. $term = false; 
  11.  
  12. if ( is_wp_error( $terms ) || empty( $terms ) && ( $default = $this->field->get_default() ) ) { 
  13. $term = get_term_by( 'slug', $default, $taxonomy ); 
  14. } elseif ( ! empty( $terms ) ) { 
  15. $term = $terms[key( $terms )]; 
  16.  
  17. if ( $term ) { 
  18. $link = get_edit_term_link( $term->term_id, $taxonomy ); 
  19. echo '<a href="', esc_url( $link ), '">', esc_html( $term->name ), '</a>';