/** * @inheritdoc */ public function rules() { $themes = []; foreach (ThemeHelper::getThemes() as $theme) { $themes[] = $theme->name; } return array(array('paginationSize', 'integer', 'max' => 200, 'min' => 1), array('theme', 'in', 'range' => $themes), array(['displayName', 'spaceOrder'], 'safe'), array('logo', 'file', 'extensions' => ['jpg', 'png', 'jpeg'], 'maxSize' => 3 * 1024 * 1024), array('logo', 'dimensionValidation', 'skipOnError' => true), array('dateInputDisplayFormat', 'in', 'range' => ['', 'php:d/m/Y'])); }
public function actionDesign() { $form = new \humhub\modules\admin\models\forms\DesignSettingsForm(); if ($form->load(Yii::$app->request->post()) && $form->validate() && $form->save()) { Yii::$app->getSession()->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved')); return $this->redirect(['/admin/setting/design']); } $themes = []; foreach (ThemeHelper::getThemes() as $theme) { $themes[$theme->name] = $theme->name; } return $this->render('design', array('model' => $form, 'themes' => $themes, 'logo' => new \humhub\libs\LogoImage())); }