<% if solr_documents_grid_block.documents? %>
<% solr_documents_grid_block.each_document.each_with_index do |(block_options, document), index| %>
<% if block_options[:thumbnail_image_url].present? %>
<%= link_to_document(document, image_tag(block_options[:thumbnail_image_url]), counter: -1) %>
<% elsif block_options[:iiif_tilesource_base].present? %>
<%= link_to_document(document, image_tag(block_options[:iiif_tilesource_base] + '/full/!400,400/0/default.jpg'), counter: -1) %>
<% elsif has_thumbnail? document %>
<%= render_thumbnail_tag(document, {}, document_counter: -1) %>
<% end %>
<% end %>
<% end %>