File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
ConfigurationModule/Forms Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 1717use Nextras \FormsRendering \Renderers \Bs3FormRenderer ;
1818use stdClass ;
1919use Throwable ;
20+ use function array_key_exists ;
2021use const UPLOAD_ERR_OK ;
2122
2223/**
@@ -71,7 +72,10 @@ public function create() : Form
7172
7273 $ form ->addText ('footer ' , 'admin.configuration.web_footer ' );
7374
74- $ form ->addSelect ('redirectAfterLogin ' , 'admin.configuration.web_redirect_after_login ' , $ this ->pageRepository ->getPagesOptions ())
75+ $ redirectAfterLoginOptions = $ this ->pageRepository ->getPagesOptions ();
76+ $ redirectAfterLoginValue = $ this ->settingsService ->getValue (Settings::REDIRECT_AFTER_LOGIN );
77+
78+ $ form ->addSelect ('redirectAfterLogin ' , 'admin.configuration.web_redirect_after_login ' , $ redirectAfterLoginOptions )
7579 ->addRule (Form::FILLED , 'admin.configuration.web_redirect_after_login_empty ' );
7680
7781 $ form ->addText ('ga_id ' , 'admin.configuration.web_ga_id ' );
@@ -80,7 +84,7 @@ public function create() : Form
8084
8185 $ form ->setDefaults ([
8286 'footer ' => $ this ->settingsService ->getValue (Settings::FOOTER ),
83- 'redirectAfterLogin ' => $ this -> settingsService -> getValue (Settings:: REDIRECT_AFTER_LOGIN ) ,
87+ 'redirectAfterLogin ' => array_key_exists ( $ redirectAfterLoginValue , $ redirectAfterLoginOptions ) ? $ redirectAfterLoginValue : null ,
8488 'ga_id ' => $ this ->settingsService ->getValue (Settings::GA_ID ),
8589 ]);
8690
Original file line number Diff line number Diff line change 2323use Nextras \FormComponents \Controls \DateTimeControl ;
2424use stdClass ;
2525use Throwable ;
26+ use function array_key_exists ;
2627use function in_array ;
2728
2829/**
@@ -178,6 +179,8 @@ public function create(int $id) : Form
178179 ->setValidationScope ([])
179180 ->setHtmlAttribute ('class ' , 'btn btn-warning ' );
180181
182+ $ redirectAfterLoginValue = $ this ->role ->getRedirectAfterLogin ();
183+
181184 $ form ->setDefaults ([
182185 'id ' => $ id ,
183186 'name ' => $ this ->role ->getName (),
@@ -192,7 +195,7 @@ public function create(int $id) : Form
192195 'minimumAge ' => $ this ->role ->getMinimumAge (),
193196 'permissions ' => $ this ->permissionRepository ->findPermissionsIds ($ this ->role ->getPermissions ()),
194197 'pages ' => $ this ->pageRepository ->findPagesSlugs ($ this ->role ->getPages ()),
195- 'redirectAfterLogin ' => $ this -> role -> getRedirectAfterLogin () ,
198+ 'redirectAfterLogin ' => array_key_exists ( $ redirectAfterLoginValue , $ pagesOptions ) ? $ redirectAfterLoginValue : null ,
196199 'incompatibleRoles ' => $ this ->roleRepository ->findRolesIds ($ this ->role ->getIncompatibleRoles ()),
197200 'requiredRoles ' => $ this ->roleRepository ->findRolesIds ($ this ->role ->getRequiredRoles ()),
198201 ]);
You can’t perform that action at this time.
0 commit comments