Select::prepare()
Description #
Prepare field.
Source #
File: lib/form/class-select.php
protected function prepare() {
$this->args = wp_parse_args(
$this->args,
array(
'label' => __( 'AnsPress Select Field', 'anspress-question-answer' ),
'options' => array(),
'terms_args' => array(
'taxonomy' => 'question_category',
'hide_empty' => false,
'fields' => 'id=>name',
'orderby' => ap_opt( 'form_category_orderby' ) ? ap_opt( 'form_category_orderby' ) : 'count',
),
)
);
// Call parent prepare().
parent::prepare();
if ( in_array( $this->get( 'options' ), array( 'posts', 'terms' ), true ) ) {
$this->sanitize_cb = array_merge( array( 'absint' ), $this->sanitize_cb );
} else {
$this->sanitize_cb = array_merge( array( 'text_field' ), $this->sanitize_cb );
}
}
Expand full source code Collapse full source code View on GitHub: lib/form/class-select.php:38
Add your comment