Last active
November 26, 2016 19:08
-
-
Save aaerofeev/5ed160f9ed96f1f0ac9847e8427e0e12 to your computer and use it in GitHub Desktop.
Drupal 8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Twig get node image field url | |
file_url(node.field_image.entity.fileuri) | |
// Twig get node url | |
path('entity.node.canonical', {'node': node.id() }) | |
// Twig field collection iterate | |
{% for market in node.field_market %} | |
<p>tagline: {{ market.getFieldCollectionItem().field_market_tagline.value|e }}</p> | |
<h2>title: {{ market.getFieldCollectionItem().field_market_title.value|e }}</h2> <br> | |
{% endfor %} | |
// Image Style load. For crop api | |
ImageStyle::load('crop_for_photo')->buildUrl($p->field_image->entity->getFileUri()) | |
// Best for drupal 8 twig! | |
// https://www.drupal.org/project/twig_tweak | |
photo.field_image.entity.fileuri | image_style('crop_for_photo') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment