Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add placeholder option for paragraph #2635

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions css/qsm-admin-question.css
Original file line number Diff line number Diff line change
Expand Up @@ -743,3 +743,6 @@ input.qsm-admin-select-page-question {
width: 330px;
}
}
#placeholder_text{
width: 100%;
}
11 changes: 11 additions & 0 deletions php/admin/options-page-questions-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ class="save-page-button button button-primary"><?php esc_html_e( 'Save Questions
$show_limit_multiple_response = '';
$show_file_upload_type = '';
$show_file_upload_limit = '';
$placeholder_text = '';
foreach ( $question_types as $type ) {
if ( isset( $type['options']['show_correct_answer_info'] ) && $type['options']['show_correct_answer_info'] ) {
$show_correct_answer_info .= ',' . $type['slug'];
Expand All @@ -369,6 +370,9 @@ class="save-page-button button button-primary"><?php esc_html_e( 'Save Questions
if ( isset( $type['options']['show_file_upload_limit'] ) && $type['options']['show_file_upload_limit'] ) {
$show_file_upload_limit .= ',' . $type['slug'];
}
if ( isset( $type['options']['placeholder_text'] ) && $type['options']['placeholder_text'] ) {
$placeholder_text .= ',' . $type['slug'];
}
}
$advanced_question_option = array(
'correct_answer_info' => array(
Expand Down Expand Up @@ -486,6 +490,13 @@ class="save-page-button button button-primary"><?php esc_html_e( 'Save Questions
'show' => '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' );
Expand Down
3 changes: 2 additions & 1 deletion php/question-types/qsm-question-type-number.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 );
?>
<input type="number" class="mlw_answer_number <?php echo esc_attr( $mlw_require_class ); ?>" id="question<?php echo esc_attr( $id ); ?>" name="question<?php echo esc_attr( $id ); ?>" <?php if ( $limit_text ) : ?>maxlength="<?php echo esc_attr( $limit_text ); ?>" oninput="checkMaxLength(this)" <?php endif; ?> <?php echo esc_attr( $min_num_attr ); ?> />
<input type="number" class="mlw_answer_number <?php echo esc_attr( $mlw_require_class ); ?>" id="question<?php echo esc_attr( $id ); ?>" name="question<?php echo esc_attr( $id ); ?>" <?php if ( $limit_text ) : ?>maxlength="<?php echo esc_attr( $limit_text ); ?>" oninput="checkMaxLength(this)" <?php endif; ?> <?php echo esc_attr( $min_num_attr ); ?> placeholder="<?php echo esc_attr( $placeholder_text ); ?>" />
<?php
echo apply_filters( 'qmn_number_display_front', '', $id, $question, $answers );
}
Expand Down
3 changes: 2 additions & 1 deletion php/question-types/qsm-question-type-paragraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function qmn_large_open_display( $id, $question, $answers ) {
$required = $mlwQuizMasterNext->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';
Expand All @@ -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 );
?>
<textarea class="mlw_answer_open_text <?php echo esc_attr( $mlw_require_class ); ?>" cols="70" rows="5" id="question<?php echo esc_attr( $id ); ?>" name="question<?php echo esc_attr( $id ); ?>" <?php if ( $limit_text ) : ?>maxlength="<?php echo esc_attr( $limit_text ); ?>"<?php endif; ?> <?php echo esc_attr( $min_length_attr ); ?> /></textarea>
<textarea class="mlw_answer_open_text <?php echo esc_attr( $mlw_require_class ); ?>" cols="70" rows="5" id="question<?php echo esc_attr( $id ); ?>" name="question<?php echo esc_attr( $id ); ?>" <?php if ( $limit_text ) : ?>maxlength="<?php echo esc_attr( $limit_text ); ?>"<?php endif; ?> <?php echo esc_attr( $min_length_attr ); ?> placeholder="<?php echo esc_attr( $placeholder_text ); ?>" /></textarea>
<?php
echo apply_filters( 'qmn_large_open_display_front', '', $id, $question, $answers );
}
Expand Down
3 changes: 2 additions & 1 deletion php/question-types/qsm-question-type-short-answer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function qmn_small_open_display( $id, $question, $answers ) {
$autofill = $mlwQuizMasterNext->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 ) {
Expand All @@ -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 );
?>
<input <?php echo esc_attr( $autofill_att ); ?> type="text" class="mlw_answer_open_text <?php echo esc_attr( $mlw_require_class ); ?>" id="question<?php echo esc_attr( $id ); ?>" name="question<?php echo esc_attr( $id ); ?>" <?php echo esc_attr( $min_text_attr ); ?> <?php if ( $limit_text ) : ?>maxlength="<?php echo esc_attr( $limit_text ); ?>"<?php endif; ?> />
<input <?php echo esc_attr( $autofill_att ); ?> type="text" class="mlw_answer_open_text <?php echo esc_attr( $mlw_require_class ); ?>" id="question<?php echo esc_attr( $id ); ?>" name="question<?php echo esc_attr( $id ); ?>" <?php echo esc_attr( $min_text_attr ); ?> <?php if ( $limit_text ) : ?>maxlength="<?php echo esc_attr( $limit_text ); ?>"<?php endif; ?> Placeholder="<?php echo esc_attr($placeholder_text); ?>" />
<?php
echo apply_filters( 'qmn_small_open_display_front', '', $id, $question, $answers );
}
Expand Down
Loading