beastbytes / yii2-wizard

Yii2 Extension to handle multi-part form wizards
Other
37 stars 21 forks source link

how to change the stepName ? #6

Open pigochu opened 8 years ago

pigochu commented 8 years ago

controller code

            $config = [
                'steps' => ['profile', 'region', 'photo'],
                'events' => [
                    WizardBehavior::EVENT_WIZARD_STEP => [$this, $action->id.'WizardStep'], 
                    WizardBehavior::EVENT_AFTER_WIZARD => [$this, $action->id.'AfterWizard'], 
                    WizardBehavior::EVENT_INVALID_STEP => [$this, 'invalidStep'],
                ]
            ];
            $config['class'] = WizardBehavior::className();
            $this->attachBehavior('wizard', $config);

view code

<?= WizardMenu::widget( .............. ); ?>

I want to design an I18N site , So I need to change step's label name to other language in the view , but step's key name needn't change , how to do it ?

mtdn commented 7 years ago

 $config = [
                'steps' => [Yii::t('Профиль') => 'profile', 'region', 'photo'],
                'events' => [
                    WizardBehavior::EVENT_WIZARD_STEP => [$this, $action->id.'WizardStep'], 
                    WizardBehavior::EVENT_AFTER_WIZARD => [$this, $action->id.'AfterWizard'], 
                    WizardBehavior::EVENT_INVALID_STEP => [$this, 'invalidStep'],
                ]
            ];
            $config['class'] = WizardBehavior::className();
            $this->attachBehavior('wizard', $config);
`