mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 02:13:15 +00:00
Merge pull request #2602 from mike-esokia/PHRAS-2053_PORT_PHRAS_2051_to_4.1
PHRAS-2053 port PHRAS 2051 to 4.1
This commit is contained in:
@@ -127,6 +127,22 @@ class TwigServiceProvider implements ServiceProviderInterface
|
||||
);
|
||||
}, ['needs_environment' => true, 'is_safe' => ['html']]));
|
||||
|
||||
$twig->addFilter(new \Twig_SimpleFilter('parseColor', function (\Twig_Environment $twig, $string) use ($app) {
|
||||
$re = '/^(.*)\[#([0-9a-fA-F]{6})]$/m';
|
||||
$stringArr = explode(';', $string);
|
||||
foreach ($stringArr as $key => $value) {
|
||||
preg_match_all($re, trim($value), $matches);
|
||||
if ($matches && $matches[1] != null && $matches[2] != null) {
|
||||
$colorCode = '#' . $matches[2][0];
|
||||
$colorName = $matches[1][0];
|
||||
|
||||
$stringArr[$key] = '<span class="color-dot" style="margin-right: 4px; background-color: ' . $colorCode . '"></span>' . $colorName . '<br />';
|
||||
}
|
||||
}
|
||||
|
||||
return implode('', $stringArr);
|
||||
}, ['needs_environment' => true, 'is_safe' => ['html']]));
|
||||
|
||||
$twig->addFilter(new \Twig_SimpleFilter('bounce',
|
||||
function (\Twig_Environment $twig, $fieldValue, $fieldName, $searchRequest, $sbasId) {
|
||||
// bounce value if it is present in thesaurus as well
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
<dl class="{% if limitedWidth %}{% else %}dl-horizontal{% endif %}">
|
||||
{% for field in record.get_caption().get_highlight_fields(null, can_see_business) %}
|
||||
<dt>{{ field.label_name }}</dt>
|
||||
<dd>{{ _self.caption_value(field, bounceable|default(true))|highlight|linkify }}</dd>
|
||||
<dd>{{ _self.caption_value(field, bounceable|default(true))|highlight|linkify|parseColor }}</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
{% if display_exif|default(true) and app.getAuthenticator().user is not none and user_setting('technical_display') == 'group' %}
|
||||
|
||||
Reference in New Issue
Block a user