Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {{ path('entity.node.canonical', {'node': element['#object'].id}) }}
- /**
- * Implements template_preprocess_field__FIELD_NAME().
- */
- function MYTHEME_preprocess_field__MYFIELD(&$variables) {
- if ($variables['element']['#entity_type'] === 'node') {
- $node = $variables['element']['#object'];
- $nid = $node->id();
- $variables['myurl'] = Drupal::service('path.alias_manager')->getAliasByPath('/node/' . $nid);
- }
- }
- {% if myurl %}
- <a href="{{ myurl }}">Kool Keith</a>
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement