Comments (5)
Would it be ok to take a look at your template code?
from linkit.
LinkIt version 0.6 on Craft 2.1.2564. LinkIt is part of an entry Matrix block (multiple types of blocks). Throws error. Using this exact setup (LinkIt as part of an entry matrix block amongst other block types) with version 0.5 on Craft 2.0.2540 does work.
{% for block in blocks %}
{% switch block.type %}
{% case "singleImageBlock" %}
{% set oneImage = block.image.first() %}
{% set pixelWidth = (960 * (block.width/100))|round(0,'ceil') %}
{% set thumb = {mode: 'fit', width: pixelWidth, quality: 75} %}
<div class="singleImage {{block.alignment}}" style="width: {{block.width}}%">
{% if block.optionalLink is defined %}
<a href="{{block.optionalLink.url}}" {{ block.optionalLink.target ? ' target="_blank"' }}><img src="{{ oneImage.url(thumb) }}" width="100%"/></a>
{% else %}
<img src="{{ oneImage.url(thumb) }}" width="100%"/>
{% endif %}
</div>
{% endswitch %}
{% endfor %}
LinkIt version 0.5 on Craft 2.0.2540. LinkIt is part of a matrix block (where a link block is the only option) inside a global set. Works fine. Using this exact setup (matrix inside global) with version 0.6 on Craft 2.1.2564 does work.
<nav id="headerNav">
<ul>
{% for link in navigation.links %}
<li><a href="{{ link.href.url }}" {{ link.href.target ? ' target="_blank"' }} {{link.href.url in craft.request.url and link.href.url != siteUrl ? 'class="active"' }} title="{{ link.href.linkText }}">{{ link.href.linkText }}</a></li>
{% endfor %}
</ul>
</nav>
LinkIt version 0.5 on Craft 2.0.2540. LinkIt is a regular entry field (not in a matrix block). Works fine.
{% switch entry.type %}
{% case "blogLink" %}
{% set blogLinkText = '"'~entry.blogFeatLink.url~'" class="blogExtLink" target="_blank"' %}
{% endswitch %}
<div class="blogPostMedSidebar">
by {{entry.author.fullName}}<br />
{{entry.postDate.format("F j, Y")}}
</div>
{% set blogNoLink = '"'~entry.url~'"' %}
<div class="col-sm-22">
<h1><a href={{ blogLinkText is defined ? blogLinkText|raw : blogNoLink|raw }}>{{entry.title}}</a></h1>
</div>
from linkit.
Can you try switching out this line:
{% if block.optionalLink is defined %}
With:
{% if block.optionalLink is defined and block.optionalLink %}
block.optionalLink will always be defined, but may not always be set (therefore returning a null variable)
I suspect this is the cause of the issues.
Let me know?
from linkit.
That does indeed work (sorry for it being such a simple issue!).
from linkit.
Not to worry, we've all been there, doesn't matter how long you look at it you just cant spot the simple ones.
Just shout if you have any other issues!
from linkit.
Related Issues (20)
- Translating doesn't work as expected HOT 3
- Allow subject to be added to email address
- Assets sources not syncing during project.yml HOT 1
- Empty custom link text for Custom URL results in 'getThirdPartyElementData' error
- Emoji in the link text
- Creating or editting a Linkit field with entry fills selection label with array of chosen sections HOT 1
- Feature Request: Allow selectable predefined config from file
- URL field doesn't accept email parameters when mailto: is used.
- Missed label of Add button
- Feature request: Reusable Linkit config options defined in files HOT 1
- Long title overflows
- Allow hash in custom urls HOT 1
- Type method in the LinkIt model doesn't return what it's supposed to HOT 1
- php fatal error
- Allow @web alias in custom url Param HOT 1
- Plugin fails to install on Craft 3.1 HOT 1
- No trial for Craft 3 HOT 4
- Error adding LinkIt to SuperTable HOT 1
- Is there a way to eager-load linked entries? HOT 8
- CraftQL Compatibility
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linkit.