isRequired && $enforceRequired ? ' required' : ''; $label = ''; return '
' . $label . self::input( $question, $name, $id, $required ) . '
'; } /** * The input element itself, chosen by the question's field type. `$required` * is a literal attribute string (' required' or ''), not user input. */ private static function input( Question $question, string $name, string $id, string $required ): string { $common = ' name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '"' . $required; if ( Question::FIELD_TEXTAREA === $question->fieldType ) { return ''; } if ( Question::FIELD_SELECT === $question->fieldType ) { $options = ''; foreach ( (array) $question->options as $option ) { $options .= ''; } return ''; } if ( Question::FIELD_CHECKBOX === $question->fieldType ) { return ''; } return ''; } }