craue / CraueFormFlowBundle

Multi-step forms for your Symfony project.
MIT License
736 stars 118 forks source link

Step::getLabel #236

Closed fracsi closed 8 years ago

fracsi commented 8 years ago

I tried to name one of my steps as Date, but it is a PHP callable so Step::getLabel tries to execute it. Maybe it should be marked explicitly if a label is a callable and not only by checking in the getLabel call by is_callable($this->label)

A simple case to reproduce:

protected loadStepConfig() {
    return [
        [
            'label' => 'date',
            'form_type' => \Symfony\Component\Form\Extension\Core\Type\FormType::class
    ];
}
craue commented 8 years ago

Thank you for reporting this issue, @fracsi.

As #237 doesn't seem to be the right approach, how about adding a new class StepLabel which would be explicit about the label being callable or not. I'll prepare a PR to see how it pans out.

fracsi commented 8 years ago

@craue For maintainability i think the new class would be the best option.