Question

I use Sonata admin, and because i use the arabic language,i want to inverse the dashboard view, i want to put the title in the right side of the page and the Logout in the left side. Also i want to put the blocks in the right side. I used this code in config.yml:

sonata_admin:
dashboard:
    blocks:
        # display a dashboard block
        - { position: right, type: sonata.admin.block.admin_list }

but it just puts the block in the right side and it does not inverse the labels to the right side.

Was it helpful?

Solution 2

You will need to override all the templates to do that it won't be a simple settings you can change. Take a look at the templating part of the documentation it will guide you.

OTHER TIPS

1/ Check if the current locale is RTL

http://en.wikipedia.org/wiki/Right-to-left

{% set _is_rtl = app.request.getLocale() in ['ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'ku', 'mzn', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi'] %}

2/ Use AdminLTE-rtl.css SonataAdmin use AdminLTE theme who dosn't support RTL (Right to Left) so we need to include this patch https://github.com/Yellowen/AdminLTE-rtl/blob/master/css/AdminLTE-rtl.css

3/Ovveriding stylesheets Css file was already configured on the configuration options side so we need to ovveride the relative block {% block stylesheets %}

Complete twig layout code

{% set stylesheets = admin_pool.getOption('stylesheets', []) %}
{% if _is_rtl %}
{% set stylesheets = stylesheets|merge(['bundles/mydemo/css/AdminLTE-rtl.css']) %}
{% endif %}

{% block stylesheets %}
    {% for stylesheet in stylesheets %}
        <link rel="stylesheet" href="{{ asset(stylesheet) }}">
    {% endfor %}
{% endblock %}
{% block body_attributes %}{{ parent() }} {{ _is_rtl?'dir="rtl"':'' }} {% endblock %}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top