From 45b2e3bd73c323ed086d2cfc8d75156e450a2152 Mon Sep 17 00:00:00 2001
From: Dan Chadwick <dan899@gmail.com>
Date: Fri, 6 Feb 2015 22:10:32 -0500
Subject: [PATCH] Issue #2417757 by DanChadwick: PHP max_input_var check
 extended to component page.

---
 includes/webform.components.inc |    5 +++++
 webform.module                  |   10 ++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/includes/webform.components.inc b/includes/webform.components.inc
index 0900f65..47c63d3 100644
--- a/includes/webform.components.inc
+++ b/includes/webform.components.inc
@@ -144,6 +144,10 @@ function webform_components_form($form, $form_state, $node) {
     '#value' => t('Save'),
     '#access' => count($node->webform['components']) > 0,
   );
+  $form['warning'] = array(
+    '#weight' => -1,
+  );
+  webform_input_vars_check($form, $form_state, 'warning');
 
   return $form;
 }
@@ -277,6 +281,7 @@ function _webform_components_form_rows($node, $cid, $component, $level, &$form,
  */
 function theme_webform_components_form($variables) {
   $output = '';
+  $output .= drupal_render_children($variables['form']['warning']);
   $output .= theme('table', array('header' => $variables['header'], 'rows' => $variables['rows'], 'attributes' => array('id' => 'webform-components')));
   $output .= drupal_render_children($variables['form']);
   return $output;
diff --git a/webform.module b/webform.module
index 5551d15..885a8ea 100644
--- a/webform.module
+++ b/webform.module
@@ -4914,7 +4914,7 @@ function webform_input_vars_check(&$form, $form_state, $parent_key = NULL) {
     $form['#pre_render'] = array('webform_pre_render_input_vars');
     $form['#input_var_waring_parent'] = $parent_key;
   }
-  if (!empty($form_state['input']) && empty($form_state['input']['form_build_id'])) {
+  if (!empty($form_state['input']) && empty($form_state['input']['op'])) {
     // A form was submitted with POST, but the form_build_id was missing. The most likely cause of this
     // is that the POST was truncated because PHP exceeded its max_input_vars limit.
     $subs = array(
@@ -4949,7 +4949,7 @@ function webform_pre_render_input_vars($element) {
         '@count' => $count,
         '@limit' => $limit,
       );
-      $element[$element['#input_var_waring_parent']]['input_vars_warning'] = array(
+      $warning = array(
         '#markup' => '<div class="messages warning">' .
                      (user_access('administer site configuration')
                         ? t('This form contains @count input elements. PHP max_input_vars is @limit and should be increased.', $subs)
@@ -4957,6 +4957,12 @@ function webform_pre_render_input_vars($element) {
                      . '</div>',
         '#weight' => -1,
       );
+      if ($element['#input_var_waring_parent']) {
+        $element[$element['#input_var_waring_parent']]['input_vars_warning'] = $warning;
+      }
+      else {
+        $element['input_vars_warning'] = $warning;
+      }
       watchdog('webform',
                'Page contains @count input elements but PHP max_input_vars is only @limit. Increase max_input_vars.',
                $subs,
-- 
1.7.8.msysgit.0

