public function createInitialFormStep($force = false)
    {
        // Only invoke once saved
        if (!$this->owner->exists()) {
            return;
        }

        // Check if first field is a step
        $fields = $this->owner->Fields();
        $firstField = $fields->first();
        if ($firstField instanceof EditableFormStep) {
            return;
        }

        // Don't create steps on write if there are no formfields, as this
        // can create duplicate first steps during publish of new records
        if (!$force && !$firstField) {
            return;
        }

        // Re-apply sort to each field starting at 2
        $next = 2;
        foreach ($fields as $field) {
            $field->Sort = $next++;
            $field->write();
        }

        // Add step
        $step = EditableFormStep::create();
        $step->Title = _t('SilverStripe\\UserForms\\Model\\EditableFormField\\EditableFormStep.TITLE_FIRST', 'First Page');
        $step->Sort = 1;
        $step->write();
        $fields->add($step);
    }
public function createInitialFormStep($force = false)
    {
        // Only invoke once saved
        if (!$this->owner->exists()) {
            return;
        }

        // Check if first field is a step
        $fields = $this->owner->Fields();
        $firstField = $fields->first();
        if ($firstField instanceof EditableFormStep) {
            return;
        }

        // Don't create steps on write if there are no formfields, as this
        // can create duplicate first steps during publish of new records
        if (!$force && !$firstField) {
            return;
        }

        // Re-apply sort to each field starting at 2
        $next = 2;
        foreach ($fields as $field) {
            $field->Sort = $next++;
            $field->write();
        }

        // Add step
        $step = EditableFormStep::create();
        $step->Title = _t('SilverStripe\\UserForms\\Model\\EditableFormField\\EditableFormStep.TITLE_FIRST', 'First Page');
        $step->Sort = 1;
        $step->write();
        $fields->add($step);
    }
public function createInitialFormStep ( $ force = false ) { // Only invoke once saved if ( ! $ this -> owner -> exists ( ) ) { return ; } // Check if first field is a step $ fields = $ this -> owner -> Fields ( ) ; $ firstField = $ fields -> first ( ) ; if ( $ firstField instanceof EditableFormStep ) { return ; } // Don't create steps on write if there are no formfields, as this // can create duplicate first steps during publish of new records if ( ! $ force && ! $ firstField ) { return ; } // Re-apply sort to each field starting at 2 $ next = 2 ; foreach ( $ fields as $ field ) { $ field -> Sort = $ next ++ ; $ field -> write ( ) ; } // Add step $ step = EditableFormStep :: create ( ) ; $ step -> Title = _t ( 'SilverStripe\\UserForms\\Model\\EditableFormField\\EditableFormStep.TITLE_FIRST' , 'First Page' ) ; $ step -> Sort = 1 ; $ step -> write ( ) ; $ fields -> add ( $ step ) ; }
A UserForm must have at least one step.
If no steps exist, create an initial step, and put all fields inside it.

@param bool $force
@return void
A UserForm must have at least one step . If no steps exist create an initial step and put all fields inside it .