From a6376cceb2c2e44a2d509d4a9515a917b293d020 Mon Sep 17 00:00:00 2001 From: manandeep singh Date: Thu, 5 Sep 2024 11:16:03 +0530 Subject: [PATCH] add placeholder option for paragraph --- css/qsm-admin-question.css | 3 +++ php/admin/options-page-questions-tab.php | 11 +++++++++++ php/question-types/qsm-question-type-number.php | 3 ++- php/question-types/qsm-question-type-paragraph.php | 3 ++- php/question-types/qsm-question-type-short-answer.php | 3 ++- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/css/qsm-admin-question.css b/css/qsm-admin-question.css index 88dfac332..b5e9e5e09 100644 --- a/css/qsm-admin-question.css +++ b/css/qsm-admin-question.css @@ -743,3 +743,6 @@ input.qsm-admin-select-page-question { width: 330px; } } +#placeholder_text{ + width: 100%; +} \ No newline at end of file diff --git a/php/admin/options-page-questions-tab.php b/php/admin/options-page-questions-tab.php index ff2789454..b9fe3e7e8 100644 --- a/php/admin/options-page-questions-tab.php +++ b/php/admin/options-page-questions-tab.php @@ -347,6 +347,7 @@ class="save-page-button button button-primary"> array( @@ -486,6 +490,13 @@ class="save-page-button button button-primary"> '11' . $show_file_upload_type, 'documentation_link' => qsm_get_plugin_link( 'docs/creating-quizzes-and-surveys/adding-and-editing-questions/', 'quiz_editor', 'file_upload_type', 'quizsurvey-file_upload_type_doc' ), ), + 'placeholder_text' => array( + 'heading' => __( 'Placeholder Text', 'quiz-master-next' ), + 'type' => 'text', + 'default' => '', + 'priority' => '1', + 'show' => '3, 5, 7' , + ), ); $advanced_question_option = apply_filters( 'qsm_question_advanced_option', $advanced_question_option ); $keys = array_column( $advanced_question_option, 'priority' ); diff --git a/php/question-types/qsm-question-type-number.php b/php/question-types/qsm-question-type-number.php index cb913e500..6159fa5f1 100644 --- a/php/question-types/qsm-question-type-number.php +++ b/php/question-types/qsm-question-type-number.php @@ -17,6 +17,7 @@ function qmn_number_display( $id, $question, $answers ) { $required = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'required' ); $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'limit_text' ); $min_num_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'min_text_length' ); + $placeholder_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'placeholder_text' ); $min_num_attr = $min_num_text ? "minlength=" . $min_num_text . "" : ''; if ( 0 == $required ) { $mlw_require_class = 'mlwRequiredNumber'; @@ -27,7 +28,7 @@ function qmn_number_display( $id, $question, $answers ) { $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' ); qsm_question_title_func( $question, '', $new_question_title, $id ); ?> - maxlength="" oninput="checkMaxLength(this)" /> + maxlength="" oninput="checkMaxLength(this)" placeholder="" /> pluginHelper->get_question_setting( $id, 'required' ); $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'limit_text' ); $min_length = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'min_text_length' ); + $placeholder_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'placeholder_text' ); $min_length_attr = $min_length ? "minlength=" . $min_length . "" : ''; if ( 0 == $required ) { $mlw_require_class = 'mlwRequiredText'; @@ -27,7 +28,7 @@ function qmn_large_open_display( $id, $question, $answers ) { $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' ); qsm_question_title_func( $question, '', $new_question_title, $id ); ?> - + pluginHelper->get_question_setting( $id, 'autofill' ); $limit_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'limit_text' ); $min_text_length = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'min_text_length' ); + $placeholder_text = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'placeholder_text' ); $autofill_att = $autofill ? "autocomplete='off' " : ''; $min_text_attr = $min_text_length ? "minlength=" . $min_text_length . "" : ''; if ( 0 == $required ) { @@ -29,7 +30,7 @@ function qmn_small_open_display( $id, $question, $answers ) { $new_question_title = $mlwQuizMasterNext->pluginHelper->get_question_setting( $id, 'question_title' ); qsm_question_title_func( $question, '', $new_question_title, $id ); ?> - type="text" class="mlw_answer_open_text " id="question" name="question" maxlength="" /> + type="text" class="mlw_answer_open_text " id="question" name="question" maxlength="" Placeholder="" />