mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 19:11:07 +00:00
Added constants for redirection values
This commit is contained in:
parent
287204cda7
commit
f052f1fd57
3 changed files with 8 additions and 3 deletions
|
@ -16,6 +16,9 @@ use Wallabag\UserBundle\Entity\User;
|
|||
*/
|
||||
class Config
|
||||
{
|
||||
const REDIRECT_TO_HOMEPAGE = 0;
|
||||
const REDIRECT_TO_CURRENT_PAGE = 1;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
|
|
|
@ -7,6 +7,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
|||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Wallabag\CoreBundle\Entity\Config;
|
||||
|
||||
class ConfigType extends AbstractType
|
||||
{
|
||||
|
@ -51,8 +52,8 @@ class ConfigType extends AbstractType
|
|||
->add('action_mark_as_read', ChoiceType::class, [
|
||||
'label' => 'config.form_settings.action_mark_as_read.label',
|
||||
'choices' => [
|
||||
'config.form_settings.action_mark_as_read.redirect_homepage' => '0',
|
||||
'config.form_settings.action_mark_as_read.redirect_current_page' => '1',
|
||||
'config.form_settings.action_mark_as_read.redirect_homepage' => Config::REDIRECT_TO_HOMEPAGE,
|
||||
'config.form_settings.action_mark_as_read.redirect_current_page' => Config::REDIRECT_TO_CURRENT_PAGE,
|
||||
],
|
||||
])
|
||||
->add('language', ChoiceType::class, [
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Helper;
|
|||
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||
use Wallabag\CoreBundle\Entity\Config;
|
||||
|
||||
/**
|
||||
* Manage redirections to avoid redirecting to empty routes.
|
||||
|
@ -27,7 +28,7 @@ class Redirect
|
|||
*/
|
||||
public function to($url, $fallback = '')
|
||||
{
|
||||
if ($this->actionMarkAsRead == 0) {
|
||||
if (Config::REDIRECT_TO_HOMEPAGE === $this->actionMarkAsRead) {
|
||||
return $this->router->generate('homepage');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue