Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
views-view-unformatted.html.twig not working as desired
{# Each Business: #}
{% set rowNum = 0 %} {# MY ATTEMPT TO SYNC THE ROW/ARRAY NUMBERS WITH THE BUSINESS NID LOOKUPS -- DOESN'T WORK #}
{% set bizNid = rows[rowNum].content['#row'].node_field_data_node__field_business_location_nid %}
{# START CARD #}
<div class="card" id="{{ bizNid }}">
{% if title %}
{{ title }}
{% endif %}
{# START Offers Container #}
<div class="card_offers transition_height" data-offers-row="{{ bizNid }}">
{# Offers Overlay #}
<div class="offers_overlay" data-overlay="{{ bizNid }}"></div>
{# START Modal Menu that goes over the offers box
(unrelated, but needs to be inside offers container) #}
<div class="menu" data-menu-modal="{{ bizNid }}">
<div class="menu_content">
<div class="menu_item">
<div class="icon_profile"></div>
<div>View Profile</div>
</div>
<div class="menu_item">
<div class="icon_call"></div>
<div>Call</div>
</div>
<div class="menu_item">
<div class="icon_suggest"></div>
<div>Suggest Update</div>
</div>
</div>
</div>
{# END Menu Modal #}
{# FYI, to access each Offer's NID, uncomment: #}
{# {{row.content['#row']._entity.nid.value}} #}
{# START Offer row(s) #}
{% for row in rows %}
{%
set row_classes = [
default_row_class ? 'views-row',
]
%}
<div{{ row.attributes.addClass(row_classes) }}>
{{ row.content }}
</div>
{% set rowNum = rowNum + 1 %} {# MY ATTEMPT TO SYNC THE ROW/ARRAY NUMBERS WITH THE BUSINESS NID LOOKUPS -- DOESN'T WORK #}
{% endfor %}
{# END Offer row(s) #}
</div>
{# END Offers Container #}
{# START SHOWMORE BUTTONS #}
<div class="showmore" data-showmore-wrapper="{{ bizNid }}"> {# I NEED THE BUSINESS NID HERE #}
<div class="expand" data-showmore-expand="{{ bizNid }}" type="button"> {# I NEED THE BUSINESS NID HERE #}
<div class="icon_expand"></div>
</div>
<div class="shrink" data-showmore-shrink="{{ bizNid }}" type="button"> {# I NEED THE BUSINESS NID HERE #}
<div class="icon_shrink"></div>
</div>
</div>
{# END SHOWMORE BUTTONS #}
{# START Bottom of Card (Menu, Links, Directions, etc) #}
<div class="card_bottom">
<div class="bottom_left">
<div class="menu_buttons">
<div class="menu_dots visible" data-menu-trigger="{{ bizNid }}" type="button"></div> {# I NEED THE BUSINESS NID HERE #}
<div class="menu_close" data-menu-close="{{ bizNid }}" type="button"></div> {# I NEED THE BUSINESS NID HERE #}
</div>
<div class="likes">
<div class="heart"></div>
<div class="count">114</div> {#AND I NEED THE BUSINESS NUMBER OF LIKES HERE.. ETC #}
</div>
</div>
<div class="bottom_right">
<div class="address">[[909 Walnut St]]</div> {# CRAP...I NEED THE BUSINESS ADDRESS INFO HERE #}
<div class="map_pin"></div>
</div>
</div>
{# END Bottom of Card #}
</div>
{# END CARD #}
{# Uncomment below to get the objects Available on this template/page: #}
{# <div class="dump">{{ dump() }}</div> #}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment