drupal - Display entity reference field values and url using entity query inside twig -
i'm trying figure out how can output values , url of entity reference field values , display them inside twig. here sample of code have constructed. can't seem find out else missing
// entity query academic experience entity $academicexperience = $query->get('node') ->condition('status', 1, '=') ->condition('type','programs') ->sort('created') ->execute(); foreach ($academicexperience $key => $academic_menu) { $academicnode = _nodeload($academic_menu); //entity reference field $variables['academic_menu'][$key]['menu'] = $academicnode->get('field_academic_experience_ref')->value; }
{% academic in academic_menu %} <span>{{ academic['menu'] }}</span> {% endfor %}
Comments
Post a Comment