I'm trying to code up a Matrix field for a homepage slider, and it contains a single 'Slide' block type. It has fields for Image (Assets), Heading (Plain Text), Sub-Heading (Plain Text), and Slide Link (Entries). I've got everything working, except for the Slide Link field (where I want to output the entry URI for the entry that was selected in that field).
Whenever I add {{ block.slideLink }}
to my template, I get the following error:
Object of class Craft\ElementCriteriaModel could not be converted to string
So I'm obviously not meant to output a link to an entry (I only have one link being selected in the field) in this way, so can someone help me out with the syntax that I need please? There weren't any Entries examples in the Matrix Field docs that I could copy from, and I couldn't figure out how to adapt the Entries Field examples to fit in with a Matrix field.
Thanks in advance for any help, and here's my code. The incorrect {{ block.slideLink }}
code is on line 11:
{% extends "_layout" %}
{% block content %}
<div class="grid-100 flexslider">
<ul class="slides">
{% for block in entry.homepageSlideshow %}
<li>
<a href="{{ block.slideLink }}">
{% set largeImage = {
mode: 'crop',
width: 1180,
height: 450,
quality: 80
} %}
{% set image = block.image.first() %}
{% if image %}
<img src="{{ image.getUrl(largeImage) }}" alt="{{ image.title }}">
{% endif %}
<div class="flex-caption grid-40">
<h2>{{ block.heading }}</h2>
<p style="font-weight: bold;">{{ block.subHeading }}</p>
</div><!-- flex-caption -->
</a>
</li>
{% endfor %}
</ul>
</div><!-- grid-100 -->
{% endblock %}