From 41542cc8213b932eaf0742620c71a60f4fbd177d Mon Sep 17 00:00:00 2001 From: Michael Strelan Date: Thu, 31 May 2018 15:11:39 +1000 Subject: [PATCH] Render form actions as webform element --- webform_submit_button.module | 15 +++------------ webform_submit_button_component.inc | 7 +++---- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/webform_submit_button.module b/webform_submit_button.module index dd94edb..f4f4cfa 100644 --- a/webform_submit_button.module +++ b/webform_submit_button.module @@ -56,20 +56,11 @@ function webform_submit_button_form_alter(&$form, &$form_state, $form_id) { if ($current_component_type == 'submit_button') { - // Get the weight of the user's submit button component. - $current_weight = $value['#webform_component']['weight']; - - // Apply the weight to the actual webform submit button. - $actions = $form['actions']; - $actions['#weight'] = $current_weight; - // Move the webform submit button into the position of the - // user's submit button component. Remove the user's component since it - // was really just a placeholder for the real thing. - + // user's submit button component. + $actions = $form['actions']; unset($form['actions']); - unset($form['submitted'][$key]); - $form['submitted']['submit_button'] = $actions; + $form['submitted'][$key]['actions'] = $actions; } } } diff --git a/webform_submit_button_component.inc b/webform_submit_button_component.inc index 4d2a599..4e86ad5 100644 --- a/webform_submit_button_component.inc +++ b/webform_submit_button_component.inc @@ -14,11 +14,10 @@ function _webform_render_submit_button($component, $value = NULL, $filter = TRUE) { $wrapper = array( '#type' => 'container', - '#attributes' => array( - 'class' => array('placeholder-for-submit-button'), - ), + '#theme_wrappers' => array('webform_element'), + '#webform_component' => $component, + '#weight' => $component['weight'], ); - return $wrapper; }