sanitization_cb in PHP class
-
Re: https://github.com/CMB2/CMB2/wiki/Field-Parameters#sanitization_c
$opts->add_field( array( 'id' => $this->field_prefix . 'item_class', 'name' => __( 'Individual CSS Class', 'my-text-domain' ), 'type' => 'text_medium', 'sanitization_cb' => array( $this, 'sanitize_css_classes' ), ) );and then, in the same PHP class:
protected function sanitize_css_classes( $value, $field_args, $field ) { $classes = explode( ' ', $value ); $output = ''; foreach ( $classes as $_v ) { $output .= ' ' . sanitize_html_class( $_v ); } return $output; }$this->sanitize_css_classes()is not getting called.Shouldn’t this
sanitization_cbwork?Thank you for the assistance.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘sanitization_cb in PHP class’ is closed to new replies.