mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 10:23:17 +00:00
show hex as icon in technical data
This commit is contained in:
@@ -127,6 +127,23 @@ class TwigServiceProvider implements ServiceProviderInterface
|
|||||||
);
|
);
|
||||||
}, ['needs_environment' => true, 'is_safe' => ['html']]));
|
}, ['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, $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>' . trim($colorName) . '<br />';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode('', $stringArr);
|
||||||
|
}, ['needs_environment' => true, 'is_safe' => ['html']]));
|
||||||
|
|
||||||
$twig->addFilter(new \Twig_SimpleFilter('bounce',
|
$twig->addFilter(new \Twig_SimpleFilter('bounce',
|
||||||
function (\Twig_Environment $twig, $fieldValue, $fieldName, $searchRequest, $sbasId) {
|
function (\Twig_Environment $twig, $fieldValue, $fieldName, $searchRequest, $sbasId) {
|
||||||
// bounce value if it is present in thesaurus as well
|
// bounce value if it is present in thesaurus as well
|
||||||
|
|||||||
@@ -128,7 +128,7 @@
|
|||||||
<dl class="{% if limitedWidth %}{% else %}dl-horizontal{% endif %}">
|
<dl class="{% if limitedWidth %}{% else %}dl-horizontal{% endif %}">
|
||||||
{% for name, value in record.getCaption(caption_field_order(record, can_see_business)) %}
|
{% for name, value in record.getCaption(caption_field_order(record, can_see_business)) %}
|
||||||
<dt>{{ caption_field_label(record, name) }}</dt>
|
<dt>{{ caption_field_label(record, name) }}</dt>
|
||||||
<dd>{{ caption_field(record, name, value)|e|highlight }}</dd>
|
<dd>{{ caption_field(record, name, value)|e|highlight|parseColor }}</dd>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</dl>
|
</dl>
|
||||||
{% if display_exif|default(true) and app.getAuthenticator().user is not none and user_setting('technical_display') == 'group' %}
|
{% 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