Permalink
Browse files

Tweaks

  • Loading branch information...
1 parent a9a935d commit 7117a01ae3f938f6f3fb4efe68f12055642a9ac8 @javiereguiluz committed Jan 10, 2017
@@ -183,7 +183,7 @@ private function doProcessConfig($backendConfig)
{
$configPasses = array(
new NormalizerConfigPass($this->container),
- new DesignConfigPass($this->container->get('twig'), $this->container->getParameter('kernel.debug')),
+ new DesignConfigPass($this->container->get('twig'), $this->container->getParameter('kernel.debug'), $this->container->getParameter('locale')),
new MenuConfigPass(),
new ActionConfigPass(),
new MetadataConfigPass($this->container->get('doctrine')),
@@ -21,20 +21,35 @@ class DesignConfigPass implements ConfigPassInterface
{
private $twig;
private $kernelDebug;
+ private $locale;
- public function __construct(\Twig_Environment $twig, $kernelDebug)
+ public function __construct(\Twig_Environment $twig, $kernelDebug, $locale)
{
- $this->kernelDebug = $kernelDebug;
$this->twig = $twig;
+ $this->kernelDebug = $kernelDebug;
+ $this->locale = $locale;
}
public function process(array $backendConfig)
{
+ $backendConfig = $this->processRtlLanguages($backendConfig);
$backendConfig = $this->processCustomCss($backendConfig);
return $backendConfig;
}
+ private function processRtlLanguages(array $backendConfig)
+ {
+ if (!isset($backendConfig['design']['rtl'])) {
+ // ar = Arabic, fa = Persian, he = Hebrew
+ if (in_array(substr($this->locale, 0, 2), array('ar', 'fa', 'he'))) {
+ $backendConfig['design']['rtl'] = true;
+ }
+ }
+
+ return $backendConfig;
+ }
+
private function processCustomCss(array $backendConfig)
{
$customCssContent = $this->twig->render('@EasyAdmin/css/easyadmin.css.twig', array(
@@ -242,10 +242,9 @@ private function addDesignSection(ArrayNodeDefinition $rootNode)
->treatNullLike('dark')
->end()
- ->enumNode('rtl')
- ->values(array(true, false))
- ->info('Enable RTL direction (values: "true" or "false").')
- ->defaultValue(false)
+ ->booleanNode('rtl')
+ ->info('If true, the interface uses RTL (right-to-left) writing (needed for Arabic, Hebrew and Persian).')
+ ->defaultFalse()
->treatNullLike(false)
->end()
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
- <file source-language="en" target-language="fr" datatype="plaintext" original="file.ext">
+ <file source-language="en" target-language="ar" datatype="plaintext" original="file.ext">
<body>
<!-- page titles -->
<trans-unit id="new.page_title">
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
- <file source-language="en" target-language="fr" datatype="plaintext" original="file.ext">
+ <file source-language="en" target-language="ar" datatype="plaintext" original="file.ext">
<body>
<!-- generic actions displayed on buttons and links -->
<trans-unit id="action.new">
@@ -43,7 +43,6 @@
{% endblock head_javascript %}
{% if easyadmin_config('design.rtl') %}
- <!-- Load RTL stylesheet -->
<link rel="stylesheet" href="{{ asset('bundles/easyadmin/stylesheet/bootstrap-rtl.min.css') }}">
<link rel="stylesheet" href="{{ asset('bundles/easyadmin/stylesheet/adminlte-rtl.min.css') }}">
{% endif %}

0 comments on commit 7117a01

Please sign in to comment.