Answers.Body: <p>You said it yourself, the problem is that an Entries field can link to multiple targets. So it is an array of Entry Models you're given here, or more correctly, an ElementCriteriaModel.</p>
  
  <p>To get the first linked entry's Url, all you have to change is to add the <code>first</code> method.</p>
  
  <pre><code>&lt;a href="{{ imageItem.imageLink.first().url }}"&gt;
  </code></pre>
  
  <p>But you said multiple links are allowed, so to show them all go through them in a loop.</p>
  
  <pre><code>{% for imageItem in block.images %}
      {% for linkedEntry in imageItem.imageLink %}
          &lt;a href="{{ linkedEntry.url }}"&gt;
              &lt;img src="{{ imageItem.url }}" alt=""&gt;
              &lt;span&gt;{{ imageItem.imageTitle }}&lt;/span&gt;
          &lt;/a&gt;
      {% endfor %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-04T09:56:18.013Z
Answers.Text: Perfect. This is my first Craft site and first time with Twig. I'm still finding my way around. Thanks.
Answers.UserDisplayName: Tim Print
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-04T10:10:02.823Z
Answers.Text: One more thing, @TimPrint. I'd recommend to always name an entries field handle in plural form, in you case it'd be `imageLinks` instead of `imageLink`. Entries fields always give you an ElementCriteriaModel and never a single Entry Model, even if you set the limit to 1 in the field settings. The same applies to asset fields, category fields, ...
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-05T15:25:02.140Z
Answers.Text: Anything still not working for you, Tim?
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-06T18:54:28.293Z
Answers.Text: Nope, all good, was just cleaning up some answers in here
Answers.UserDisplayName: Tim Print
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-07T20:16:14.840Z
Answers.Text: Sorry! I always forget you need to click that accept button. Done. Thanks again.
Answers.UserDisplayName: Tim Print
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-04T05:59:25.640Z
Answers.LastActivityDate: 2015-03-04T05:59:25.640Z
Answers.UserDisplayName: carlcs
Body: <p>I have an Asset source "Image link gallery" with two custom fields for each Asset: "image title" (text field) &amp; "Image link" (Entries field - can link to multiple sources).</p>
  
  <p>I have a Matrix block "Image link Gallery" with an Assets field "Images" which selects from this Asset source.</p>
  
  <p>I want to be be able to select a bunch of images and return the image, title, and link to the entry.</p>
  
  <pre><code>{% for imageItem in block.images %}
      &lt;a href="{{ imageItem.imageLink.uri }}"&gt;
          &lt;img src="{{ imageItem.url }}" alt=""&gt;
          &lt;span&gt;{{ imageItem.imageTitle }}&lt;/span&gt;
      &lt;/a&gt;
  {% endfor %}
  </code></pre>
  
  <p>This is returning all the images and titles but no links.</p>
  
  <p>Where am I going wrong?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-04T04:49:05.453Z
Comments.Text: In dev mode, what comes up with {{dump(imageItem.imageLink)}}?
Comments.UserDisplayName: Aaron Berkowitz
Tags: <assets><matrix><relations>
Title: Asset with related entry field in Matrix block
ThreadText: # Asset with related entry field in Matrix block
  
  (Asked by: username_0 on 2015-03-04)
  
  I have an Asset source "Image link gallery" with two custom fields for each Asset: "image title" (text field) & "Image link" (Entries field - can link to multiple sources).
  
  I have a Matrix block "Image link Gallery" with an Assets field "Images" which selects from this Asset source.
  
  I want to be be able to select a bunch of images and return the image, title, and link to the entry.
  
  ```
  {% for imageItem in block.images %}
      <a href="{{ imageItem.imageLink.uri }}">
          <img src="{{ imageItem.url }}" alt="">
          <span>{{ imageItem.imageTitle }}</span>
      </a>
  {% endfor %}
  
  ```
  
  This is returning all the images and titles but no links.
  
  Where am I going wrong?
  
  **Tags:** assets, matrix, relations
  
  > **Comments:**
  > **username_1**: In dev mode, what comes up with {{dump(imageItem.imageLink)}}?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2015-03-04. Score: 2 | Accepted answer
  
  You said it yourself, the problem is that an Entries field can link to multiple targets. So it is an array of Entry Models you're given here, or more correctly, an ElementCriteriaModel.
  
  To get the first linked entry's Url, all you have to change is to add the `first` method.
  
  ```
  <a href="{{ imageItem.imageLink.first().url }}">
  
  ```
  
  But you said multiple links are allowed, so to show them all go through them in a loop.
  
  ```
  {% for imageItem in block.images %}
      {% for linkedEntry in imageItem.imageLink %}
          <a href="{{ linkedEntry.url }}">
              <img src="{{ imageItem.url }}" alt="">
              <span>{{ imageItem.imageTitle }}</span>
          </a>
      {% endfor %}
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Perfect. This is my first Craft site and first time with Twig. I'm still finding my way around. Thanks.  
  > **username_2**: One more thing, @username_0. I'd recommend to always name an entries field handle in plural form, in you case it'd be `imageLinks` instead of `imageLink`. Entries fields always give you an ElementCriteriaModel and never a single Entry Model, even if you set the limit to 1 in the field settings. The same applies to asset fields, category fields, ...  
  > **username_2**: Anything still not working for you, Tim?  
  > **username_0**: Nope, all good, was just cleaning up some answers in here  
  > **username_0**: Sorry! I always forget you need to click that accept button. Done. Thanks again.  
  
  ---
  
  