Search code examples
phpsymfonyeasyadmin

The layout of the index and CRUD pages are from right to left instead of left to right in Easyadmin using Symfony framework


When I log on to easyadmin everything seems normal like this.

example

But once I refresh the page everything looks likes it's on the opposite direction it is supposed to be like this.

example

The code I have is as follows:

<?php

namespace App\Controller\Admin;

use App\Entity\Post;
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use EasyCorp\Bundle\EasyAdminBundle\Router\CrudUrlGenerator;

class DashboardController extends AbstractDashboardController
{
    /**
     * @Route("/admin", name="admin")
     */
    public function index(): Response
    {
        $routeBuilder = $this->get(CrudUrlGenerator::class)->build();

        return $this->redirect($routeBuilder->setController(PostCrudController::class)->generateUrl());
    }

    public function configureDashboard(): Dashboard
    {
        return Dashboard::new()
            ->setTitle('Dashboard');
    }

    public function configureMenuItems(): iterable
    {
        yield MenuItem::linkToCrud('Nieuws', 'far fa-newspaper', Post::class);
    }
}

In the CRUD pages the same problem persists. Thanks in advance!


Solution

  • Okay so I fixed it by adding ->setTextDirection('ltr'); to the configureDashboard like this:

    public function configureDashboard() : Dashboard
    {
        return Dashboard::new()
            ->setTitle('Dashboard')
            ->setTextDirection('ltr');
    }