slug = 'Dropdown'; $this->title = esc_attr__( 'Dropdown', 'questions-locale' ); $this->description = esc_attr__( 'Add a question which can be answered within a dropdown field.', 'questions-locale' ); $this->icon_url = QUESTIONS_URLPATH . '/assets/images/icon-dropdown.png'; $this->has_answers = TRUE; $this->answer_is_multiple = FALSE; $this->is_analyzable = TRUE; $this->answer_syntax = ' %s'; $this->answer_selected_syntax = ' %s'; $this->answer_params = array( 'value', 'answer' ); $this->create_answer_syntax = '
'; $this->create_answer_params = array( 'name', 'answer' ); parent::__construct( $id ); } public function input_html() { $html = ''; return $html; } public function settings_fields() { $this->settings_fields = array( 'description' => array( 'title' => esc_attr__( 'Description', 'questions-locale' ), 'type' => 'textarea', 'description' => esc_attr__( 'The description will be shown after the question.', 'questions-locale' ), 'default' => '' ), ); } public function validate( $input ) { $error = FALSE; if ( 'please-select' == $input ): $this->validate_errors[ ] = sprintf( esc_attr__( 'Please select a value.', 'questions-locale' ) ); $error = TRUE; endif; if ( $error ): return FALSE; endif; return TRUE; } } qu_register_survey_element( 'Questions_FormElement_Dropdown' );