From 112d58143d2356f6def0ccd1692548bdb44a88fa Mon Sep 17 00:00:00 2001 From: buttflattery Date: Sat, 8 Feb 2020 17:59:54 +0500 Subject: [PATCH] added constants --- src/FormWizard.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/FormWizard.php b/src/FormWizard.php index 834272d..24c4c9f 100644 --- a/src/FormWizard.php +++ b/src/FormWizard.php @@ -403,9 +403,17 @@ class FormWizard extends Widget const BS_4 = 4; /** - * ICONS + * TEXT LABELS CONSTANTS * */ + const DEFAULT_FORM_INFO_TEXT = 'Add details below'; + const DEFAULT_STEP_DESCRIPTION = 'Description'; + const PREVIEW_TITLE = 'Final Preview'; + const PREVIEW_DESCRIPTION = 'Final Preview of all Steps'; + const PREVIEW_FORM_INFO_TEXT = 'Review information below and click to change'; + /** + * ICONS + * */ const ICON_NEXT = ''; const ICON_PREV = ''; const ICON_FINISH = ''; @@ -649,9 +657,9 @@ public function createFormWizard() [ [ 'type' => self::STEP_TYPE_PREVIEW, - 'title' => 'Final Preview', - 'description' => 'Final Preview of all Steps', - 'formInfoText' => 'Review information below and click to change', + 'title' => self::PREVIEW_TITLE, + 'description' => self::PREVIEW_DESCRIPTION, + 'formInfoText' => self::PREVIEW_FORM_INFO_TEXT, ], ] ); @@ -693,10 +701,10 @@ public function createStep($index, $step) $stepTitle = ArrayHelper::getValue($step, 'title', 'Step-' . ($index + 1)); //step description - $stepDescription = ArrayHelper::getValue($step, 'description', 'Description'); + $stepDescription = ArrayHelper::getValue($step, 'description', self::DEFAULT_STEP_DESCRIPTION); //form body info text - $formInfoText = ArrayHelper::getValue($step, 'formInfoText', 'Add details below'); + $formInfoText = ArrayHelper::getValue($step, 'formInfoText', self::DEFAULT_FORM_INFO_TEXT); //get html tabs $htmlTabs = $this->createTabs($index, $stepDescription, $stepTitle); @@ -982,8 +990,8 @@ public function registerScripts($pluginOptions, $isBs3, $jsOptionsPersistence) //is supported theme if (in_array($themeSelected, array_keys($this->themesSupported))) { - $themeAsset = __NAMESPACE__ . '\assetbundles\bs' . - $this->_bsVersion . '\Theme' . + $themeAsset = __NAMESPACE__ . '\\assetbundles\\bs' . + $this->_bsVersion . '\\Theme' . $this->themesSupported[$themeSelected] . 'Asset'; $themeAsset::register($view);