mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
PHRAS-2816 #comment hidden fields on roll over and detailled view depending on gui_editable attribute #time 6h
This commit is contained in:
@@ -48,6 +48,7 @@ class PhraseanetExtension extends \Twig_Extension
|
|||||||
new \Twig_SimpleFunction('border_checker_from_fqcn', array($this, 'getCheckerFromFQCN')),
|
new \Twig_SimpleFunction('border_checker_from_fqcn', array($this, 'getCheckerFromFQCN')),
|
||||||
new \Twig_SimpleFunction('caption_field', array($this, 'getCaptionField')),
|
new \Twig_SimpleFunction('caption_field', array($this, 'getCaptionField')),
|
||||||
new \Twig_SimpleFunction('caption_field_label', array($this, 'getCaptionFieldLabel')),
|
new \Twig_SimpleFunction('caption_field_label', array($this, 'getCaptionFieldLabel')),
|
||||||
|
new \Twig_SimpleFunction('caption_field_gui_editable', array($this, 'getCaptionFieldGuiEditable')),
|
||||||
new \Twig_SimpleFunction('caption_field_order', array($this, 'getCaptionFieldOrder')),
|
new \Twig_SimpleFunction('caption_field_order', array($this, 'getCaptionFieldOrder')),
|
||||||
|
|
||||||
new \Twig_SimpleFunction('flag_slugify', array(Flag::class, 'normalizeName')),
|
new \Twig_SimpleFunction('flag_slugify', array(Flag::class, 'normalizeName')),
|
||||||
@@ -77,6 +78,29 @@ class PhraseanetExtension extends \Twig_Extension
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get localized field's gui_editable
|
||||||
|
* @param RecordInterface $record
|
||||||
|
* @param $fieldName
|
||||||
|
* @return string - the name gui_editable
|
||||||
|
*/
|
||||||
|
public function getCaptionFieldGuiEditable(RecordInterface $record, $fieldName)
|
||||||
|
{
|
||||||
|
if ($record) {
|
||||||
|
/** @var \appbox $appbox */
|
||||||
|
$appbox = $this->app['phraseanet.appbox'];
|
||||||
|
$databox = $appbox->get_databox($record->getDataboxId());
|
||||||
|
foreach ($databox->get_meta_structure() as $meta) {
|
||||||
|
/** @var \databox_field $meta */
|
||||||
|
if ($meta->get_name() === $fieldName) {
|
||||||
|
return $meta->get_gui_editable($this->app['locale']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
public function getCaptionField(RecordInterface $record, $field, $value)
|
public function getCaptionField(RecordInterface $record, $field, $value)
|
||||||
{
|
{
|
||||||
if ($record instanceof ElasticsearchRecord) {
|
if ($record instanceof ElasticsearchRecord) {
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
{% macro caption(record, can_see_business, display_exif, limitedWidth = false) %}
|
{% macro caption(record, can_see_business, display_exif, limitedWidth = false) %}
|
||||||
<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>
|
{% if caption_field_gui_editable(record, name) == 1 %}
|
||||||
<dd>{{ caption_field(record, name, value)|e|highlight|linkify|parseColor }}</dd>
|
<dt>{{ caption_field_label(record, name) }}</dt>
|
||||||
|
<dd>{{ caption_field(record, name, value)|e|highlight|linkify|parseColor }}</dd>
|
||||||
|
{% endif %}
|
||||||
{% 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