0

Im using Drupal 6 and the multistep module :

I need to display informations in a block apart when my users wether add or edit some of the available multistep forms :

. there's a block that shows up with an EDIT title when EDITING an existing node with information within it for this case :

only shows up when :
node/*/edit* page

. there's a block that shows up with a CREATE title when ADDING a node :

only shows up when :
node/add/multistep-content-A*
node/add/multistep-content-B*
node/*/edit*

node//edit is necessary for ADDING since when the user finishes the first step of the form, the node is saved and the link which was node/add/m-c-A turns into node/nid/edit.

in both block I use a bit of php ( url arg(), $node) to check content type, to retrieve node info if exists, to decide wether show info for ADDING cases or for EDITING cases. (as there's nothing to show, the entire block DIV does not show up)

I would need to recognize the ADDING case after step 2 of the form... when the node is created but when the progress bar is lesser than 100%.

in other words, to retrieve the 'completion status' argument from the multistep module, the one that tells the progress bar if the form is completed or not.

it appears it's not in the $node array.. ?

EDIT : found a trick, see comment 2.

4
  • there's a _multistep_is_complete(&$form_state) function in the mstep module, what is $form_state..
    – jerome
    Mar 23, 2013 at 13:32
  • well ok, I found a way using $node->status and tells multistep to only publish at node completion :) still, I dont know how to retrieve the form status.
    – jerome
    Mar 23, 2013 at 14:38
  • If you found an answer yourself, it's good to post the answer below, and mark it as accepted so that everyone knows the issue is resolved. Btw, welcome.
    – Phizes
    Mar 23, 2013 at 19:32
  • Awesome, now you just need to accept it, which is done with the check/tick below the points voting in the top left hand corner of the answer. After that, all is good, and it will help other people with the same pronlem to find an answer more easily. Thanks!
    – Phizes
    Mar 24, 2013 at 9:29

1 Answer 1

0

I dont know how to retrieve the multistep completion state from a block but there's a simple way, by testing the published status (not published ? not complete ADD/PENDING - published ? complete EDIT)

in admin/settings/multistep : select Publishing > at node completion

in the ADD block that must be displayed when adding a multistep node : only display block on the pages below :

node/add/multistep-content-A*
node/add/multistep-content-B*
node/*/edit*

in the ADD block body :

Title : add

<?php
$show = FALSE ;
if ( arg(0) == 'node' && arg(1) == 'add' ) {
  if (in_array(arg(2), array( "multistep-content-A", "multistep-content-B" ))) {
    $show = TRUE ;
    $node = False ;
  }
}
elseif ( arg(0) == 'node' && is_numeric(arg(1)) ) {
  $node = node_load(arg(1));
  if (in_array($node->type, array( "multistep-content-A", "multistep-content-B" )) && $node->status == 0) {
    $show = TRUE ;
  }
}
if ($show) {
  if ($node) print '<center>id : <b>'.$node->nid . '</b></center>' ;
  print "<ul><li>some info about creating this node.</li><li>be sure to complete every step blah blah <i>the italic ones</i></li></ul>" ;
}
?>

in the EDIT block :

Title : modify

node/*/edit*

body :

<?php
if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
  $node = node_load(arg(1));
  if (in_array($node->type, array( "multistep-content-A", "multistep-content-B" )) && $node->status == 1) {
    print '<center>id fiche : <b>'.$node->nid . '</b></center>' ;
    print "<ul><li>some info about editing an existing node.</li><li>browse directly to the steps you need to modify by using the link below.</li></ul>" ;
  }
}
?>

there might be a way to only have one block, that could change its title itself, I didn't investigate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.