Several locations trigger PHP notices, sometimes on completely unrelated pages. Patch makes multistep shut up.

CommentFileSizeAuthor
notices.patch2.59 KBsmk-ka

Comments

smk-ka’s picture

+++ multistep.module	3 Feb 2010 10:24:39 -0000
@@ -803,7 +806,7 @@ function _multistep_is_complete(&$form_s
-  $override = module_invoke_all('multistep_update_status', $form_state, $status, $current_step);
+  $override = module_invoke_all('multistep_update_status', $form_state, $current_step);

This part is actually a bit tricky: the code refers to a variable $status, which is nowhere used, and probably a leftover from a previous version. Removing it obviously results in an API change. Not sure how to handle it correctly.

smk-ka’s picture

Priority: Normal » Minor
Status: Active » Needs review
haagendazs’s picture

Hey smk-ka: Thanks for creating this patch. I didn't apply the whole thing (as you mentioned, there might be some problems regarding the API change), but I tested the first two parts and they worked fine.

To be exact: These two parts of the patch work great:

@@ -160,7 +160,7 @@ function multistep_field_access($op, $fi
       $group = _fieldgroup_field_get_group($type, $field['field_name']);
       $groups = fieldgroup_groups($type);
       // Set #access to FALSE if the current field does not belong in the current step.
-      if ($field['widget']['multistep'] != $step && !$groups[$group]) {
+      if (isset($field['widget']['multistep']) && $field['widget']['multistep'] != $step && !$groups[$group]) {
         return FALSE;
       }
       // Set #access to FALSE if the current field's group does not belong in the current step.
@@ -367,11 +367,12 @@ function multistep_widget_settings_alter
  * This is the node-editing form.
  */
 function multistep_form_alter(&$form, &$form_state, $form_id) {
-  $type = $form['#node']->type;
+  if (substr_count($form_id, 'node_form') <= 0 || arg(0) == 'admin') {
+    return;
+  }
   // Do nothing if multistep is not enabled for this node type.
-  if (variable_get('multistep_expose_' . $type, 'disabled') != 'enabled'
-  || substr_count($form_id, 'node_form') <= 0
-  || arg(0) == 'admin') {
+  $type = $form['#node']->type;
+  if (variable_get('multistep_expose_' . $type, 'disabled') != 'enabled') {
     return;
   }
vkareh’s picture

Priority: Minor » Normal
Status: Needs review » Fixed

Thanks for the patch! I committed it to the development snapshot.

Just to clarify, the $status variable is not directly used, but the API allows implementations of the function to have access to it, in case they want to use it as part of their hook implementation. No changes to the API were needed, but I added a default value in case the variable is missing. In it's absence, it should default to 'unsubmitted'. Thanks again!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.