CMB2_Display_Select

The CMB2 CMB2 Display Select class.

Defined (1)

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

/includes/CMB2_Field_Display.php  
  1. class CMB2_Display_Select extends CMB2_Field_Display { 
  2. /** 
  3. * Display select value. 
  4. * @since 2.2.2 
  5. */ 
  6. protected function _display() { 
  7. $options = $this->field->options(); 
  8.  
  9. $fallback = $this->field->args( 'show_option_none' ); 
  10. if ( ! $fallback && isset( $options[''] ) ) { 
  11. $fallback = $options['']; 
  12. if ( ! $this->value && $fallback ) { 
  13. echo $fallback; 
  14. } elseif ( isset( $options[ $this->value ] ) ) { 
  15. echo $options[ $this->value ]; 
  16. } else { 
  17. echo esc_attr( $this->value );