Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I want to add a progressbar like this at top of all steps:
Step(1) --> Step(2) --> Step(3) --> Step(4)
Code:
function mymodule_form_contenttype_node_form_alter(&$form, &$form_state, $form_id) {
$steps = '<div id="sub_nav"><ul class="steps-bc">';
$additional_class = '';
$counter = 0;
foreach ($form['#steps'] as $step) {
$steps .= '<li class="' . $step->step_name '">' . $step->label . "</li>";
}
$steps .= '</ul></div>';
$form['steps_div'] = array(
'#markup' => $steps
);
$form['#step_children']['steps_div'] = 'step_1';
}
Using above code I can only add the form element to one step(step_intro), but it should be shown on top of all steps. Form element is not a input field so it shouldn't cause any error. How do I add it to all steps?
I need something like:
$form['#step_children']['steps_div'] = array('step_1', 'step_2', 'step_3', 'step_4');
But it doesn't work.
Comments
Comment #1
stBorchertYou don't need this as there is already something like this built into Multistep Nodeform.
The module creates a block with information about all available steps (highlighting the current one). You need to go to admin/structure/block and move the block named "Multistep Nodeform: Step information" into the proper region.
hth,
Stefan
Comment #2
hp_ir CreditAttribution: hp_ir commentedThanks. It is not documented neither in README.txt nor in the project page , is it?
Comment #3
rooby CreditAttribution: rooby commentedComment #5
stBorchertI've added a note to the README.txt.