/** * @param Gravity_Flow_Step $step * @param $entry * @param $form * * @return bool|Gravity_Flow_Step */ public function get_next_step($step, $entry, $form) { $keep_looking = true; $form_id = absint($form['id']); $steps = $this->get_steps($form_id, $entry); while ($keep_looking) { $next_step_id = $step->get_next_step_id(); if ($next_step_id == 'complete') { return false; } if ($next_step_id == 'next') { $step = $this->get_next_step_in_list($form, $step, $entry, $steps); $keep_looking = false; } else { $step = $this->get_step($next_step_id, $entry); if (!$step->is_active() || !$step->is_condition_met($form)) { $step = $this->get_next_step_in_list($form, $step, $entry, $steps); } else { $keep_looking = false; } } } return $step; }