-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to disable flipcss for the backend only #7
Comments
flipcss is a twig filter if you don't want back-end in rtl mode simply disable or uninstall plugin. class Plugin extends PluginBase
{
public function register()
{
$this->registerMarkupTags();
}
public function registerMarkupTags()
{
MarkupManager::instance()->registerCallback(function ($manager) {
$manager->registerFilters([
'flipCss' => [$this, 'flipCss'],
]);
});
}
/**
* Twig Markup Filter 'flipCss'
* @param $paths
* @param bool $force
* @return array|string
*/
public function flipCss($paths)
{
if (!is_array($paths)) {
$paths = [$paths];
}
$rPaths = [];
foreach ($paths as $path) {
$assetPath = $path;
if (File::exists(dirname($assetPath) . '/' . File::name($assetPath) . '.rtl.' . File::extension($assetPath))) {
$newPath = dirname($assetPath) . '.rtl.' . File::extension($assetPath);
} else {
$newPath = CssFlipper::flipCss($assetPath, true);
}
$rPaths[] = $newPath;
}
return $rPaths;
}
} |
Thank you very much.
Appreciated.
Le ven. 3 mai 2019 à 09:43, Sajjad Servatjoo <notifications@github.com> a
écrit :
… flipcss is a twig filter if you don't want back-end in rtl mode simply
disable or uninstall plugin.
you can write a simple plugin for flipcss twig filter with using this
class
https://github.com/octoberfa/oc-persian/blob/master/classes/CssFlipper.php
<http://CSSFlipper> and add this code in your plugin.php file
class Plugin extends PluginBase{ public function register() { $this->registerMarkupTags(); } public function registerMarkupTags() { MarkupManager::instance()->registerCallback(function ($manager) { $manager->registerFilters([ 'flipCss' => [$this, 'flipCss'], ]); }); } /** * Twig Markup Filter 'flipCss' * @param $paths * @param bool $force * @return array|string */ public function flipCss($paths) { if (!is_array($paths)) { $paths = [$paths]; } $rPaths = []; foreach ($paths as $path) { $assetPath = $path; if (File::exists(dirname($assetPath) . '/' . File::name($assetPath) . '.rtl.' . File::extension($assetPath))) { $newPath = dirname($assetPath) . '.rtl.' . File::extension($assetPath); } else { $newPath = CssFlipper::flipCss($assetPath, true); } $rPaths[] = $newPath; } return $rPaths; }}
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AL34BIVEUJ7WZFCS37N6BFLPTP3JPANCNFSM4HJ6GHKQ>
.
--
Ahmed DHIFI
AAWEB Design & Développement
+216 52 790 164
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
It'll be nice to have the option to disable the flipcss just for the backend.
Most users prefer to user the backend in english while the frontend is localised.
THanks
The text was updated successfully, but these errors were encountered: