$this->sanitize_options( isset( $raw['options'] ) ? $raw['options'] : array() ), ); } /** {@inheritdoc} */ public function validate( $value, array $field ) { if ( ! in_array( (string) $value, $this->option_values( $field ), true ) ) { return __( 'Choose one of the options.', 'fillaro' ); } return ''; } /** {@inheritdoc} */ public function to_text( $value, array $field ) { return $this->option_label( $field, $value ); } /** {@inheritdoc} */ public function render_control( array $field, array $ctx ) { $attrs = $this->base_attrs( $field, $ctx ); unset( $attrs['placeholder'] ); $attrs['class'] = 'pf-input pf-select'; $html = 'attrs( $attrs ) . '>'; $html .= ''; foreach ( $field['options'] as $option ) { $html .= sprintf( '', esc_attr( $option['value'] ), selected( (string) $ctx['value'], $option['value'], false ), esc_html( $option['label'] ) ); } return $html . ''; } }