Skip to content
This repository was archived by the owner on Nov 28, 2018. It is now read-only.
This repository was archived by the owner on Nov 28, 2018. It is now read-only.

Simple PBN #10

@dm-coding

Description

@dm-coding

This is a feature request, not a bug.

Complex PBN works great with cakephp-wizard but what about simple PBN? If a given input is a certain value I might want to add a single step, for instance. The PBN in cakephp wizard is not terribly efficient for this scenario.

I envision the API could be trivially extended with getNextStep() and setNextStep() methods in the _processStepX() part of the controller - and, conceptually, that may be a simpler way to envisage complex PBN as well.

In any case the following code works for me - you may want to update the wiki to list this as an alternative to the PBN you have designed:

public function wizard($step = null) {
$wizard_data = $this->Wizard->read();

           //e.g. $condition = !empty($wizard_data['stepname']['data_to_branch_on'];

    if($condition)) {
        $first_array = array_splice ($this->wizard_steps_array, 0, $step_number);
        $this->wizard_steps_array = array_merge ($first_array, $additional_steps_array, $this->wizard_steps_array);
    }
    $this->Wizard->steps = $this->wizard_steps_array;

}

All the best,
Daniel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions