src/Elements/Bundle/DemiFrontendBundle/Resources/views/Infrastructure/detail.html.twig line 1

Open in your IDE?
  1. {#
  2. /**
  3.  * @var \Pimcore\Templating\PhpEngine view
  4.  * @var \Pimcore\Templating\GlobalVariables app
  5.  * #
  6.  * @var infrastructure Infrastructure
  7.  * @var detailEvents \Elements\Bundle\DemiFrontendBundle\Service\EventSearchFrontend
  8.  */ #}
  9. {% set infraType = 'infrastructure' %}
  10. {% set url = linkGenerator().generate(infrastructure) %}
  11. {% do elements_canonical().checkAllParams(false).setDomain(url) %}
  12. {% if not url is same as(app.request.pathInfo) or infrastructure.getProperty('seo_noindex') == true %}
  13.     {% do elements_robots().setNoIndex(true) %}
  14. {% endif %}
  15. {#{% do elements_hreflang(['de', 'en']) %}#}
  16. {% set metaTitle = infrastructure.getName() %}
  17. {% set town = not infrastructure.getTowns() is empty ? infrastructure.getTowns()[0] : null %}
  18. {% if town %}
  19.     {% set metaTitle = metaTitle ~ " " ~ 'demi.seo.in' | trans ~ " " ~ town.getName() %}
  20. {% endif %}
  21. {% if infrastructure.getMetaTitle() != '' %}
  22.     {% set  metaTitle = infrastructure.getMetaTitle() %}
  23. {% endif %}
  24. {% set metaDesc = infrastructure.getShortDescription() %}
  25. {% if metaDesc is empty %}
  26.     {% set  metaDesc = infrastructure.getLongDescription() %}
  27. {% endif %}
  28. {% if infrastructure.getMetaDescription() != '' %}
  29.     {% set metaDesc = infrastructure.getMetaDescription() %}
  30. {% endif %}
  31. {% if metaDesc is empty %}
  32.     {% set metaDesc = demi_fillTranslation({"[OBJECT]" : infrastructure.getName(),
  33.         "[TOWN]" : town.getName(), "[REGION]" : town ? town.getRegion().getName() : ""}, "demi.infrastructure.detail.seo.fallbackdescription") %}
  34. {% endif %}
  35. {#    {% do pimcore_placeholder('object_seotitle').set(metaTitle) %}#}
  36. {#    {% do pimcore_placeholder('object_seodescription').set(metaDesc) %}#}
  37. {% do elements_head_title().setTitle(metaTitle, true) %}
  38. {% do elements_head_meta().setDescription(metaDesc, true) %}
  39. {% do jsConfig().add('backButton', true) %}
  40. {% do pimcore_placeholder('addBreadcrumb').set({
  41.     'parentId' : document.getId(),
  42.     'url' : url,
  43.     'label' : infrastructure.getName()
  44. }) %}
  45. {% set currDate = carbon().create() %}
  46. {% do elements_opengraph().setUrl(url) %}
  47. {% set detailSlides = infrastructure.getImageDocuments(null, currDate) %}
  48. {% if infrastructure.getFirstImage() is not empty  %}
  49.     {% do elements_opengraph().addImage(infrastructure.getFirstImage().getThumbnail('slider-main').getPath()) %}
  50. {% endif %}
  51. {% extends('@ElementsDemiFrontend/Layout/project-layout.html.twig') %}
  52. {% block content %}
  53.     {% set headerShort = '' %}
  54.     {% set headerLong = '' %}
  55.     {% if infrastructure.getDescriptions() is not empty %}
  56.         {% set headerShort = infrastructure.getShortDescription(app.request.getLocale(), currDate) %}
  57.     {% endif %}
  58.     {% if headerShort is empty %}
  59.         {% set headerShort = infrastructure.getShortDescription(demi_core_configuration("getFallBackLanguage",{}), currDate) %}
  60.     {% endif %}
  61.     {% set headerLong = infrastructure.getLongDescription(app.request.getLocale(), currDate) %}
  62.     {% if headerLong is empty %}
  63.         {% set headerLong = infrastructure.getLongDescription(demi_core_configuration("getFallBackLanguage",{}), currDate) %}
  64.     {% endif %}
  65.     {% set descriptionTypes = [] %}
  66.     {% set localDescriptions= [] %}
  67.     {% set arrivalDocuments = [] %}
  68.     {% for description in infrastructure.getDescriptions(app.request.locale) | filter((description) => description.getDescriptionLanguage is same as app.request.locale()) %}
  69.         {% if description.getProperty("demi_descriptionType") is not empty and description.getDescriptionType() is same as constant("\\Elements\\Demi\\Deskline\\Constant\\DescriptionInterface::DESCRIPTION_FERATEL_LOCAL") %}
  70.             {% set localDescriptions = localDescriptions | merge([description]) %}
  71.         {% elseif description.getDescriptionType() is same as constant("\\Elements\\Demi\\Deskline\\Constant\\DescriptionInterface::DESCRIPTION_ADDITIONAL_SERVICE_ARRIVAL") %}
  72.             {% set arrivalDocuments = arrivalDocuments|merge([description]) %}
  73.         {% else %}
  74.             {% set descriptionTypes = descriptionTypes | merge([description.getDescriptionType()]) %}
  75.         {% endif %}
  76.     {% endfor %}
  77.     {% set descriptionTypes = descriptionTypes | filter((value) => value not in descriptionTypes and
  78.         value is not same as constant('\\Elements\\Demi\\Deskline\\Constant\\DescriptionInterface::DESCRIPTION_INFRASTRUCTURE_LONG') and
  79.         value is not same as constant('\\Elements\\Demi\\Deskline\\Constant\\DescriptionInterface::DESCRIPTION_INFRASTRUCTURE_CURRENT_INFORMATION') and
  80.         value is not same as constant('\\Elements\\Demi\\Deskline\\Constant\\DescriptionInterface::DESCRIPTION_INFRASTRUCTURE_OPENING_TIMES') and
  81.         value is not same as constant('\\Elements\\Demi\\Deskline\\Constant\\DescriptionInterface::DESCRIPTION_INFRASTRUCTURE_PRICE_INFO') and
  82.         value is not same as constant('\\Elements\\Demi\\Deskline\\Constant\\DescriptionInterface::DESCRIPTION_INFRASTRUCTURE_SHORT')) %}
  83.     {% set cat = null %}
  84.     {% if infrastructure.getTopics() | first is not same as false %}
  85.         {% set cat = (infrastructure.getTopics() | first).getParent() %}
  86.     {% endif %}
  87.     {% set currentRange = demi_infrastructureGetOpeningHoursPretty(infrastructure, 'getOpeningTimes') %}
  88.     {% set jsonLd = demi_infrastructureGetJsonLdData(infrastructure, {"prettyOpeningTimes" : currentRange, "currtime" : currDate, "locale" : app.request.getLocale(), "metadesc" : metaDesc}) %}
  89.     {% do jsonLd().add("infrastructure", jsonLd) %}
  90. {#    {{ include("@ElementsDemiFrontend/Includes/canonicalOverride.html.twig", {#}
  91. {#        "object" : infrastructure#}
  92. {#    }) }}#}
  93.     {{ include('@ElementsDemiFrontend/Includes/tags/detail-infrastructure.html.twig', {
  94.         'infrastructure' : infrastructure,
  95.         'category' : cat
  96.     }) }}
  97.     <div id="demi-infrastructure-content" class="demi-infrastructure-detail">
  98.         {% set coord = [] %}
  99.         {% if infrastructure.getPosition() is not empty %}
  100.             {% set coord = {
  101.                 'lat' : infrastructure.getPosition().getLatitude(),
  102.                 'lng' : infrastructure.getPosition().getLongitude()
  103.             } %}
  104.         {% endif %}
  105.         {% set openingTimes = infrastructure.getOpeningTimesDescription(app.request.getLocale(), currDate) %}
  106.         {% set  allDescriptions = infrastructure.getPriceInfoDescription(app.request.getLocale(), currDate) %}
  107.         {% set address = infrastructure.getAddress() %}
  108.         {% set addressBlock = [] %}
  109.         {% if address %}
  110.             {% if address.getCompany() is not same as '' %}
  111.                 {% set addressBlock = addressBlock|merge([address.getCompany()]) %}
  112.             {% endif %}
  113.             {% if address.getFirstname() is not same as '' %}
  114.                 {% set  addressBlock = addressBlock|merge([address.getFirstname() ~ ' ' ~ address.getLastname()]) %}
  115.             {% endif %}
  116.             {% if address.getAddressLine1() is not same as '' %}
  117.                 {% set addressBlock = addressBlock|merge([address.getAddressLine1()]) %}
  118.             {% endif %}
  119.             {% if address.getAddressLine2() is not same as '' %}
  120.                 {% set addressBlock = addressBlock|merge([address.getAddressLine2()]) %}
  121.             {% endif %}
  122.             {% if address.getZipcode() is not same as '' or address.getTown() %}
  123.                 {% set addressBlock = addressBlock|merge([address.getZipcode() ~ ' ' ~ address.getTown()]) %}
  124.             {% endif %}
  125.         {% endif %}
  126.         {% set  generalDocuments = [] %}
  127.         {% for doc in infrastructure.getDocuments() %}
  128.             {% if doc is not instanceof("\\Pimcore\\Model\\DataObject\\DemiDocumentImage") %}
  129.                 {% set generalDocuments = generalDocuments|merge([doc]) %}
  130.             {% endif %}
  131.         {% endfor %}
  132.         {% if infrastructure.foodAndBeverageSeatsInside or infrastructure.foodAndBeverageSeatsOutside %}
  133.             {% set seatsTxt = '' %}
  134.             {% if infrastructure.foodAndBeverageSeatsInside %}
  135.                 {% set seatsTxt = seatsTxt ~ '<br><strong>' ~ 'infrastructure.detail.seats-inside'|trans  ~ '</strong>: ' ~ infrastructure.foodAndBeverageSeatsInside %}
  136.             {% endif %}
  137.             {% if infrastructure.foodAndBeverageSeatsOutside %}
  138.                 {% set seatsTxt = seatsTxt ~ '<br><strong>' ~ 'infrastructure.detail.seats-outside'|trans  ~ '</strong>: ' ~ infrastructure.foodAndBeverageSeatsOutside %}
  139.             {% endif %}
  140.         {% endif %}
  141.         {% set coord = addressBlock is not empty %}
  142.         {% set templateData = {
  143.             'headerImage' : infrastructure.getFirstImage(null, currDate),
  144.             'detailHeadline' : infrastructure.getName(),
  145.             'detailLead' : headerShort,
  146.             'detailDescription' : headerLong ~ seatsTxt|default(''),
  147.             'currentInformation' : infrastructure.getDescription(constant('\\Elements\\Demi\\Deskline\\Constant\\DescriptionInterface::DESCRIPTION_INFRASTRUCTURE_CURRENT_INFORMATION'), app.request.getLocale(), currDate),
  148.             'hasGlossar' : not document.getProperty('noGlossary'),
  149.             'detailSlides' : detailSlides,
  150.             'detailDocuments' : generalDocuments ,
  151.             'videos' : videos ?? null,
  152.             'icon' : 'icon-marker',
  153.             'detailOpeningTimes' : openingTimes,
  154.             'openingTimes' : currentRange,
  155.             'arrivalDocuments' : arrivalDocuments,
  156.             'detailAccordionId' : 0,
  157.             'detailPriceText' : allDescriptions,
  158.             'detailEvents' : detailEvents ?? null,
  159.             'detailContactHeadline' : 'demi.infrastructure.detail.contact' | trans,
  160.             'headerMapCoord' : coord,
  161.             'googlePlaceId' : infrastructure.getProperty('google_place_id'),
  162.             'detailContact' : (address is not empty and addressBlock | length > 0 ? {
  163.                 'address' : addressBlock | join('<br>'),
  164.                 'phone' : address.getPhone(),
  165.                 'mobile' : address.getMobile(),
  166.                 'mail' : address.getEmail(),
  167.                 'url' : address.getUrl(),
  168.             } : []),
  169.             'linkheadline' : 'demi.infrastructure.detail.links.headline' | trans,
  170.             'linkliste' : infrastructure.getLinks(),
  171.             'backlinktext' : 'demi.infrastructure.back' | trans,
  172.             'detailExtension' : infrastructure.getDemiExtension(),
  173.             'detailDescriptionTypes' : descriptionTypes,
  174.             'detailLocalDescriptions' : localDescriptions,
  175.             'sortedHealthMeasures' : sortedHealthMeasures
  176.             } %}
  177.         {{ include('@ElementsDemiFrontend/Infrastructure/detail/detail-templates.html.twig', {
  178.             "templateData" : templateData
  179.         }) }}
  180.         {{ include('@ElementsDemiFrontend/Infrastructure/includes/slide-before-footer.html.twig') }}
  181.     </div>
  182. {% endblock %}