I upgraded to Assets 2.1 yesterday and am experiencing a problem when a non-required Assets 2.1 field in a Matrix row is empty. On a single-entry template (limit=“1” and require_entry=“yes” parameters in my exp:channel:entries tag) this situation is causing the {if no_results} conditional to be invoked. Selecting a file for the empty, non-required, Assets field and re-saving the entry fixes the problem.
Thanks in advance for your help.
Matrix 2.5.3 ExpressionEngine 2.5.2 Build 20120606
Here is template code that will trigger the issue:
{exp:channel:entries channel="videos" limit="1" status="open" disable="categories|category_fields|pagination|member_data" require_entry="yes"}{if no_results}{redirect="404"}{/if}<!doctype html>
<html lang="en">
<head>
<title>Page Title</title>
</head>
<body>
<h2>Videos</h2>
{sidebar_videos limit="1"}
<iframe src="//www.youtube.com/embed/{youtube_video_id}"></iframe>
<p>{youtube_caption}</p>
{/sidebar_videos}
<h3>All Videos</h3>
<ul id="videothumbs">
{sidebar_videos}
<li><a href="/features/videos/{entry_id}/{row_id}" title="{youtube_title}”>{youtube_thumbnail}<img src="{url}" alt="{alt_text}">{/youtube_thumbnail}</a></li>
{/sidebar_videos}
</ul>
</body>
</html>
{/exp:channel:entries}
{sidebar_videos}
is my Matrix field, which is not required. {youtube_thumbnail}
is the problem Assets field within the Matrix field. The other columns in the Matrix field are:
{youtube_title}
(Text/required)
{youtube_video_id}
(Text/required)
{youtube_caption}
(Wygwam/required)
{youtube_thumbnail}
(Assets/not required)