diff --git a/components/pagebreak.inc b/components/pagebreak.inc index c89524a..3285f6d 100644 --- a/components/pagebreak.inc +++ b/components/pagebreak.inc @@ -16,6 +16,8 @@ function _webform_defaults_pagebreak() { 'weight' => 0, 'extra' => array( 'private' => FALSE, + 'next_page_label' => '', + 'prev_page_label' => '', ), ); } @@ -45,6 +47,21 @@ function _webform_edit_pagebreak($component) { $form['display'] = array('#type' => 'markup'); // Hide the display options. + $form['extra']['next_page_label'] = array( + '#type' => 'textfield', + '#title' => t('Next page button label'), + '#description' => t('This is used for the Next Page button on the page before this page break. Default: Next Page >'), + '#default_value' => $component['extra']['next_page_label'], + '#size' => 30, + ); + $form['extra']['prev_page_label'] = array( + '#type' => 'textfield', + '#title' => t('Prev page button label'), + '#description' => t('This is used for the Prev Page button on the page after this page break. Default: < Prev Page'), + '#default_value' => $component['extra']['prev_page_label'], + '#size' => 30, + ); + return $form; } diff --git a/includes/webform.components.inc b/includes/webform.components.inc index d1de2f3..0c5222c 100644 --- a/includes/webform.components.inc +++ b/includes/webform.components.inc @@ -383,6 +383,7 @@ function webform_component_edit_form(&$form_state, $node, $component, $clone = F '#weight' => -9, ); + $form['extra'] = array(); if (webform_component_feature($component['type'], 'description')) { $form['extra']['description'] = array( '#type' => 'textarea', diff --git a/webform.module b/webform.module index 83b390a..f73b69a 100644 --- a/webform.module +++ b/webform.module @@ -1806,11 +1806,20 @@ function webform_client_form(&$form_state, $node, $submission, $is_draft = FALSE $page_count = $form_state['webform']['page_count']; $page_num = $form_state['webform']['page_num']; + if ($page_count > 1) { + $next_page_labels = array(); + $prev_page_labels = array(); + } + // Recursively add components to the form. The unfiltered version of the // form (typically used in Form Builder), includes all components. foreach ($component_tree['children'] as $cid => $component) { $component_value = isset($form_state['values']['submitted'][$cid]) ? $form_state['values']['submitted'][$cid] : NULL; if ($filter == FALSE || _webform_client_form_rule_check($node, $component, $page_num, $form_state)) { + if ($component['type'] == 'pagebreak') { + $next_page_labels[$component['page_num'] - 1] = !empty($component['extra']['next_page_label']) ? $component['extra']['next_page_label'] : t('Next Page >'); + $prev_page_labels[$component['page_num']] = !empty($component['extra']['prev_page_label']) ? $component['extra']['prev_page_label'] : t('< Previous Page'); + } _webform_client_form_add_component($node, $component, $component_value, $form['submitted'], $form, $form_state, $submission, 'form', $page_num, $filter); } } @@ -1861,14 +1870,11 @@ function webform_client_form(&$form_state, $node, $submission, $is_draft = FALSE } if ($page_count > 1) { - $next_page = t('Next Page >'); - $prev_page = t('< Previous Page'); - // Add the submit button(s). if ($page_num > 1) { $form['actions']['previous'] = array( '#type' => 'submit', - '#value' => $prev_page, + '#value' => $prev_page_labels[$page_num], '#weight' => 5, '#validate' => array(), '#attributes' => array('formnovalidate' => 'formnovalidate'), @@ -1884,7 +1890,7 @@ function webform_client_form(&$form_state, $node, $submission, $is_draft = FALSE elseif ($page_num < $page_count) { $form['actions']['next'] = array( '#type' => 'submit', - '#value' => $next_page, + '#value' => $next_page_labels[$page_num], '#weight' => 10, ); }