{% if translation_text is not defined %}
{% if translation is not defined %}
{% set translation = text_unit.findWork().selectTranslation() %}
{% endif %}
{% set translation_text = text_unit.findTranslatedVersion(translation) %}
{% elseif translation_text is not null %}
{% if text_unit is not defined %}
{% set text_unit = translation_text.placement %}
{% endif %}
{% if translation is not defined %}
{% set translation = translation_text.translation %}
{% endif %}
{% endif %}
{% set bOnMobile = app.session.get('is_on_mobile') %}
{% set bHas2Columns = (columns is defined and columns|length >= 2) %}
{% set nColNum = 0 %}
{% set nTargetColNum = 2 %}
{% if column_num is defined %}
{% set nColNum = column_num %}
{% if bHas2Columns %}
{% set nTargetColNum = 3 %}
{% endif %}
{% endif %}
{% if text_unit.illustrations is not empty %}
{% set nLanguageID = translation.language.id %}
{% set aMedia = text_unit.illustrations %}
{% if aMedia is not empty %}
{% set audio_file = null %}
{% for media in aMedia if media.mediatype_id == 2 and audio_file == null %}
{% if media.language_id == nLanguageID %}
{% set audio_file = media %}
{% endif %}
{% endfor %}
{% if audio_file == null %}
{% for media in aMedia if media.mediatype_id == 2 and audio_file == null %}
{% if media.language_id == null %}
{% set audio_file = media %}
{% endif %}
{% endfor %}
{% endif %}
{% if audio_file == null %}
{% for media in aMedia if media.mediatype_id == 2 and audio_file == null %}
{% if media.language_id == 123 %}
{% set audio_file = media %}
{% endif %}
{% endfor %}
{% endif %}
{% if audio_file != null %}
<p>
{% include "NCBSWBundle:Media:image_tag.html.twig" with {'image_entity': audio_file, 'border': 1} %}
<br /><br />
{% endif %}
{% if category_concept is not defined %}
{% set image_file = null %}
{% for media in aMedia if media.mediatype_id == 1 and image_file == null %}
{% if media.language_id == nLanguageID %}
{% set image_file = media %}
{% endif %}
{% endfor %}
{% if image_file == null %}
{% for media in aMedia if media.mediatype_id == 1 and image_file == null %}
{% if media.language_id == null %}
{% set image_file = media %}
{% endif %}
{% endfor %}
{% endif %}
{% if image_file == null %}
{% for media in aMedia if media.mediatype_id == 1 and image_file == null %}
{% if media.language_id == 123 %}
{% set image_file = media %}
{% endif %}
{% endfor %}
{% endif %}
{% if image_file != null %}
{% include "NCBSWBundle:Media:image_tag.html.twig" with {'image_entity': image_file, 'border': 1} %}
<p>
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% if translation_text is null %}
<p><i>{{ app.session.get('ui_str')["exposition.passage.missingsubsection"] }}</i></p>
{% else %}
<p{% if text_unit.subsection is not empty %} class="anchor" id="subsection-{{ nColNum }}-{{ text_unit.subsection }}"{% endif %}>
{% if ref_column_spec is not defined %}
{% set ref_column_spec = column_replace_uri(text_unit.getPassage()) %}
{% endif %}
{% set bShowTranslatorNote = text_unit.getPassage().getSwedenborgSection() == '0' %}
{% set aColumn1 = ref_column_spec|split('_') %}
{% set bHasNote = false %}
{% set bSetItalic = false %}
{% for item in translation_text.displayItems %}{#
#}{% if not bHasNote and item.type_id in [4,5,6] %}
<p>
<strong>
{% if bShowTranslatorNote %}
{{ app.session.get('ui_str')["translators.notes"] }}:
{% else %}
{{ app.session.get('ui_str')["exposition.footnote.heading"] }}:
{% endif %}
</strong>
<br>
<div class="footnote-section">
<p>
{% set bHasNote = true %}{#
#}{% endif %}{#
#}{% include "NCBSWBundle:Exposition:display_behaviors/behaviors.html.twig" with {'type_id' : item.type_id} %}{% else %}{#
#}{% include 'NCBSWBundle:Exposition:show_text.html.twig' with {'vText': translation_text.text} %}{#
#}{% endfor %}
</p>
{% if bHasNote %}
</div><p>
{% endif %}
{% if passage_ref is defined and passage_ref is not empty %}
{% set textunit_id = text_unit.id %}
{% set bHasRef = false %}
{% set aRef = passage_ref %}
{% for reference in aRef if not bHasRef %}
{% if reference["textunit_id"] == textunit_id %}
{% set bHasRef = true %}
{% endif %}
{% endfor %}
{% set story_translation_str = '' %}
{% if story_translation_url is defined and story_translation_url != null %}
{% set story_translation_str = '_'~story_translation_url %}
{% endif %}
{% if bHasRef %}
<p><i>({{ app.session.get('ui_str')["exposition.passage.refs"] }}
{% set sCurrBookID = '' %}{#
#}{% set bHasRef = false %}{#
#}{% for reference in aRef %}{#
#}{% if reference["textunit_id"] == textunit_id %}{#
#}{% if bOnMobile %}{% set link_target = reference['singlelink'] %}{% else %}{% set multi_column_spec = reference["multilink_text"] %}{#
#}{% if story is defined and story.getLevelId() == 1 %}{#
#}{% set exp_column_spec = ref_column_spec %}{#
#}{% set link_target = path('arbitrary_three_column', {'column1Details': 'biblestory_'~story.url~story_translation_str, 'column2Details': exp_column_spec, 'column3Details': multi_column_spec}) %}{#
#}{% elseif bHas2Columns and multi_column_spec != '' %}{#
#}{% set link_target = path('arbitrary_three_column', multicolumn_route_params|merge({('column3Details'): multi_column_spec}) ) %}{#
#}{% elseif compare_to is defined and compare_to is not null and multi_column_spec != '' and (aColumn1|length == 3)%}{#
#}{% set sTransUrl = compare_to.getUrl() %}{#
#}{% set ref_column_spec2 = aColumn1[0] ~ '_' ~ sTransUrl ~ '_' ~ aColumn1[2] %}{#
#}{% set link_target = path('arbitrary_three_column', {'column1Details': ref_column_spec, 'column2Details': ref_column_spec2, 'column3Details': multi_column_spec}) %}{#
#}{% elseif ref_column_spec != '' and multi_column_spec != '' %}{#
#}{% if bible_col_spec is defined and bible_col_spec != '' %}{% set link_target = path('arbitrary_three_column', {'column1Details': bible_col_spec, 'column2Details': ref_column_spec, 'column3Details': multi_column_spec}) %}{% else %}{% set link_target = path('arbitrary_two_column', {'column1Details': ref_column_spec, 'column2Details': multi_column_spec}) %}{% endif %}{#
#}{% else %}{#
#}{#% set link_target = uri(reference) %#}{#
#}{% endif %}{% endif %}{#
#}{% set sLink = reference["link_text"] %}{#
#}{% set sDivider = ';' %}{#
#}{% if sCurrBookID != '' and sCurrBookID == reference["book_id"] %}{#
#}{% set sDivider = ',' %}{#
#}{% else %}{#
#}{% set sCurrBookID = reference["book_id"] %}{#
#}{% endif %}{#
#}{% if not reference["is_bibleref"] and reference["ordering2"] > 1 %}{#
#}{% set link_target = link_target ~ '#subsection-' ~ nTargetColNum ~ '-' ~ reference["ordering2"] %}{#
#}{% endif %}{#
#}{% if bHasRef %}{{ sDivider }}{% endif %} <a href="{{ link_target }}" target=_top >{{ sLink }}</a>{% set bHasRef = true %}{% endif %}{% endfor %})</i></p>{% if not loop.last %}<br />{% endif %}
{% endif %}
{% endif %}
{% endif %}