Loading src/Controller/RedirectPageByRoleController.php +10 −2 Original line number Diff line number Diff line Loading @@ -158,6 +158,11 @@ class RedirectPageByRoleController extends ControllerBase { if (empty($rule['redirect_to'])) { continue; } if ($rule["skip_rule"]) { return []; } $default_redirect_rules[$role]['redirect_to'] = $rule['redirect_to']; $default_redirect_rules[$role]['weight'] = $rule['weight']; } Loading Loading @@ -189,7 +194,7 @@ class RedirectPageByRoleController extends ControllerBase { } /** * Verify ir the user has permission to bypass the redirection rules. * Verify if the user has permission to bypass the redirection rules. * * @param array $user_roles * Array with user's roles. Loading @@ -210,7 +215,7 @@ class RedirectPageByRoleController extends ControllerBase { } /** * Select which redirection rule must be send. * Selects which redirection rule must be sent. * * @param array $redirection_rules * Array with redirection rules. Loading @@ -221,6 +226,9 @@ class RedirectPageByRoleController extends ControllerBase { * Returns the array with the redirection rule or returns FALSE. */ private function selectRuleByRole(array $redirection_rules, array $user_roles) { if (!$redirection_rules) { return FALSE; } foreach ($redirection_rules as $role => $redirection_rule) { if (is_object($redirection_rule)) { $redirection_rule = json_decode(json_encode($redirection_rule), TRUE); Loading src/Form/RedirectPageByRoleSettingsForm.php +5 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ class RedirectPageByRoleSettingsForm extends ConfigFormBase { $node_types = $this->entityStorage->loadMultiple(); $node_types_header = [ $this->t('Role'), $this->t('Skip bundle rule'), $this->t('Redirect to'), $this->t('Weight'), ]; Loading Loading @@ -120,6 +121,10 @@ class RedirectPageByRoleSettingsForm extends ConfigFormBase { 'label' => [ '#plain_text' => $role->label(), ], 'skip_rule' => [ '#type' => 'checkbox', '#default_value' => $config->get($type)[$id]["skip_rule"] ?? '', ], 'redirect_to' => [ '#type' => 'textfield', '#default_value' => $config->get($type)[$id]["redirect_to"] ?? '', Loading Loading
src/Controller/RedirectPageByRoleController.php +10 −2 Original line number Diff line number Diff line Loading @@ -158,6 +158,11 @@ class RedirectPageByRoleController extends ControllerBase { if (empty($rule['redirect_to'])) { continue; } if ($rule["skip_rule"]) { return []; } $default_redirect_rules[$role]['redirect_to'] = $rule['redirect_to']; $default_redirect_rules[$role]['weight'] = $rule['weight']; } Loading Loading @@ -189,7 +194,7 @@ class RedirectPageByRoleController extends ControllerBase { } /** * Verify ir the user has permission to bypass the redirection rules. * Verify if the user has permission to bypass the redirection rules. * * @param array $user_roles * Array with user's roles. Loading @@ -210,7 +215,7 @@ class RedirectPageByRoleController extends ControllerBase { } /** * Select which redirection rule must be send. * Selects which redirection rule must be sent. * * @param array $redirection_rules * Array with redirection rules. Loading @@ -221,6 +226,9 @@ class RedirectPageByRoleController extends ControllerBase { * Returns the array with the redirection rule or returns FALSE. */ private function selectRuleByRole(array $redirection_rules, array $user_roles) { if (!$redirection_rules) { return FALSE; } foreach ($redirection_rules as $role => $redirection_rule) { if (is_object($redirection_rule)) { $redirection_rule = json_decode(json_encode($redirection_rule), TRUE); Loading
src/Form/RedirectPageByRoleSettingsForm.php +5 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ class RedirectPageByRoleSettingsForm extends ConfigFormBase { $node_types = $this->entityStorage->loadMultiple(); $node_types_header = [ $this->t('Role'), $this->t('Skip bundle rule'), $this->t('Redirect to'), $this->t('Weight'), ]; Loading Loading @@ -120,6 +121,10 @@ class RedirectPageByRoleSettingsForm extends ConfigFormBase { 'label' => [ '#plain_text' => $role->label(), ], 'skip_rule' => [ '#type' => 'checkbox', '#default_value' => $config->get($type)[$id]["skip_rule"] ?? '', ], 'redirect_to' => [ '#type' => 'textfield', '#default_value' => $config->get($type)[$id]["redirect_to"] ?? '', Loading