/** * * _display_label_for_option_type_question * Gets the HTML for the 'label', which is just text for this (because labels * should be for each input) * * @param EE_Form_Input_With_Options_Base $input * @return string */ protected function _display_label_for_option_type_question(EE_Form_Input_With_Options_Base $input) { if ($input->display_html_label_text() != '') { $class = $input->required() ? 'ee-required-label ' . $input->html_label_class() : $input->html_label_class(); $label_text = $input->required() ? $input->html_label_text() . '<span class="ee-asterisk">*</span>' : $input->html_label_text(); $html = '<div id="' . $input->html_label_id() . '"'; $html .= ' class="' . $class . '"'; $html .= ' style="' . $input->html_label_style() . '">'; $html .= $label_text . '</div>'; return $html; } else { return ''; } }
/** * @param array $answer_options * @param array $input_settings */ function __construct($answer_options, $input_settings = array()) { $this->_set_display_strategy(new EE_Radio_Button_Display_Strategy()); $this->_add_validation_strategy(new EE_Enum_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL)); $this->_multiple_selections = FALSE; parent::__construct($answer_options, $input_settings); }
/** * @param array | EE_Question_Option[] $answer_options * @param array $input_settings */ public function __construct($answer_options, $input_settings = array()) { $this->_set_display_strategy(new EE_Select_Multiple_Display_Strategy()); $this->_add_validation_strategy(new EE_Many_Valued_Validation_Strategy(array(new EE_Enum_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL)))); $this->_multiple_selections = TRUE; parent::__construct($answer_options, $input_settings); }
/** * Before setting the default, sets the options so that the current selections * appear on initial display * * @param mixed $value * @return void * @throws \EE_Error */ public function set_default($value) { $values_for_options = (array) $value; $value_field = $this->_get_model()->field_settings_for($this->_value_field_name); $display_field = $this->_get_model()->field_settings_for($this->_display_field_name); $display_values = $this->_get_model()->get_all_wpdb_results(array(array($this->_value_field_name => array('IN', $values_for_options))), ARRAY_A, implode(',', array($value_field->get_qualified_column() . ' AS ' . $this->_value_field_name, $display_field->get_qualified_column() . ' AS ' . $this->_display_field_name))); $select_options = array(); foreach ($display_values as $db_rows) { $db_rows = (array) $db_rows; $select_options[$db_rows[$this->_value_field_name]] = $db_rows[$this->_display_field_name]; } $this->set_select_options($select_options); parent::set_default($value); }
/** * @param array $answer_options * @param array $input_settings */ public function __construct($answer_options, $input_settings = array()) { $this->_set_display_strategy(new EE_Select_Display_Strategy($answer_options)); $this->_add_validation_strategy(new EE_Enum_Validation_Strategy(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : null)); parent::__construct($answer_options, $input_settings); }