mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-05 04:46:03 +01:00
Fix for substitutions passed in via twig function (they need to be in an array) - #574
This commit is contained in:
@@ -3,9 +3,9 @@
|
|||||||
data-remodal-options="hashTracking: false">
|
data-remodal-options="hashTracking: false">
|
||||||
<form>
|
<form>
|
||||||
<div class="remove-package-confirm">
|
<div class="remove-package-confirm">
|
||||||
<h1>{{ "PLUGIN_ADMIN.REMOVE_THE"|tu(("PLUGIN_ADMIN." ~ type|upper)|tu) }}</h1>
|
<h1>{{ "PLUGIN_ADMIN.REMOVE_THE"|tu([("PLUGIN_ADMIN." ~ type|upper)|tu]) }}</h1>
|
||||||
<p class="bigger">
|
<p class="bigger">
|
||||||
{{ "PLUGIN_ADMIN.CONFIRM_REMOVAL"|tu(("PLUGIN_ADMIN." ~ type|upper)|tu) }}
|
{{ "PLUGIN_ADMIN.CONFIRM_REMOVAL"|tu([("PLUGIN_ADMIN." ~ type|upper)|tu]) }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="button-bar">
|
<div class="button-bar">
|
||||||
@@ -15,9 +15,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="remove-package-dependencies hidden">
|
<div class="remove-package-dependencies hidden">
|
||||||
<h1>{{ "PLUGIN_ADMIN.REMOVED_SUCCESSFULLY"|tu(("PLUGIN_ADMIN." ~ type|upper)|tu) }}</h1>
|
<h1>{{ "PLUGIN_ADMIN.REMOVED_SUCCESSFULLY"|tu([("PLUGIN_ADMIN." ~ type|upper)|tu]) }}</h1>
|
||||||
<p>
|
<p>
|
||||||
{{ "PLUGIN_ADMIN.ADDITIONAL_DEPENDENCIES_CAN_BE_REMOVED"|tu(("PLUGIN_ADMIN." ~ type|upper)|tu) }}
|
{{ "PLUGIN_ADMIN.ADDITIONAL_DEPENDENCIES_CAN_BE_REMOVED"|tu([("PLUGIN_ADMIN." ~ type|upper)|tu]) }}
|
||||||
</p>
|
</p>
|
||||||
<div>
|
<div>
|
||||||
<ul class="package-dependencies-container"></ul>
|
<ul class="package-dependencies-container"></ul>
|
||||||
@@ -25,14 +25,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="remove-package-done hidden">
|
<div class="remove-package-done hidden">
|
||||||
<h1>{{ "PLUGIN_ADMIN.REMOVED_SUCCESSFULLY"|tu(("PLUGIN_ADMIN." ~ type|upper)|tu) }}</h1>
|
<h1>{{ "PLUGIN_ADMIN.REMOVED_SUCCESSFULLY"|tu([("PLUGIN_ADMIN." ~ type|upper)|tu]) }}</h1>
|
||||||
<div class="button-bar">
|
<div class="button-bar">
|
||||||
<a href="{{ base_url_relative ~ '/' ~ type ~ 's' }}" class="button secondary"><i class="fa fa-fw fa-close"></i> {{ "PLUGIN_ADMIN.CLOSE"|tu }}</a>
|
<a href="{{ base_url_relative ~ '/' ~ type ~ 's' }}" class="button secondary"><i class="fa fa-fw fa-close"></i> {{ "PLUGIN_ADMIN.CLOSE"|tu }}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="remove-package-error hidden">
|
<div class="remove-package-error hidden">
|
||||||
<h1>{{ "PLUGIN_ADMIN.ERROR_REMOVING_THE"|tu(("PLUGIN_ADMIN." ~ type|upper)|tu) }}</h1>
|
<h1>{{ "PLUGIN_ADMIN.ERROR_REMOVING_THE"|tu([("PLUGIN_ADMIN." ~ type|upper)|tu]) }}</h1>
|
||||||
<div class="button-bar">
|
<div class="button-bar">
|
||||||
<button data-remodal-action="cancel" class="button secondary remodal-cancel"><i class="fa fa-fw fa-close"></i> {{ "PLUGIN_ADMIN.CANCEL"|tu }}</button>
|
<button data-remodal-action="cancel" class="button secondary remodal-cancel"><i class="fa fa-fw fa-close"></i> {{ "PLUGIN_ADMIN.CANCEL"|tu }}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -45,8 +45,19 @@ class AdminTwigExtension extends \Twig_Extension
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tuFilter($args, $lang = null)
|
public function tuFilter()
|
||||||
{
|
{
|
||||||
|
$args = func_get_args();
|
||||||
|
$numargs = count($args);
|
||||||
|
$lang = null;
|
||||||
|
|
||||||
|
if (($numargs == 3 && is_array($args[1])) || ($numargs == 2 && !is_array($args[1]))) {
|
||||||
|
$lang = array_pop($args);
|
||||||
|
} elseif ($numargs == 2 && is_array($args[1])) {
|
||||||
|
$subs = array_pop($args);
|
||||||
|
$args = array_merge($args, $subs);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->grav['admin']->translate($args, $lang);
|
return $this->grav['admin']->translate($args, $lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user