Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
Update image.php
Browse files Browse the repository at this point in the history
Handle slice types in image_with_caption other than just the default
  • Loading branch information
raulg committed Jan 18, 2019
1 parent ea596b7 commit 8acc97b
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions app/views/slices/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,34 @@
$imageUrl = $imageWithCaption->image->url;
$caption = $imageWithCaption->caption;

echo "<div class='post-part single container'><p class='block-img'>";
echo "<img src='" . $imageUrl . "'/>";
if ( $caption ) {
echo "<p><span class='image-label'>" . RichText::asText($caption) . "</span></p>";
}
echo "</p></div>";
switch ( $slice->slice_label ) {

// Full width image
case "image-full-width":
echo "<div class='blog-header single' style='background-image: url(" . $imageUrl . ");'><div class='wrapper'>";
if ( $caption ) {
echo "<h1>" . RichText::asText($caption) . "</h1>";
}
echo "</div></div>";
break;

// Emphasized image
case "emphasized":
echo "<div class='post-part single container'><p class='block-img emphasized'>";
echo "<img src='" . $imageUrl . "'/>";
if ( $caption ) {
echo "<p><span class='image-label'>" . RichText::asText($caption) . "</span></p>";
}
echo "</p></div>";
break;

// Default image
default:
echo "<div class='post-part single container'><p class='block-img'>";
echo "<img src='" . $imageUrl . "'/>";
if ( $caption ) {
echo "<p><span class='image-label'>" . RichText::asText($caption) . "</span></p>";
}
echo "</p></div>";
break;
}

0 comments on commit 8acc97b

Please sign in to comment.