<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
/* Block/recommend_recipe.twig */
class __TwigTemplate_3f1288c33de3e962b4bb6d7894e327e9 extends \Eccube\Twig\Template
{
private $source;
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
$this->sandbox = $this->env->getExtension('\Twig\Extension\SandboxExtension');
$this->checkSecurity();
}
protected function doDisplay(array $context, array $blocks = [])
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "Block/recommend_recipe.twig"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "Block/recommend_recipe.twig"));
// line 1
if (array_key_exists("Product", $context)) {
// line 2
echo " ";
$context["RecommendRecipe"] = twig_get_attribute($this->env, $this->source, $this->env->getFunction('repository')->getCallable()("Plugin\\Recipe\\Entity\\Recipe"), "getRecommendRecipe", [0 => (isset($context["Product"]) || array_key_exists("Product", $context) ? $context["Product"] : (function () { throw new RuntimeError('Variable "Product" does not exist.', 2, $this->source); })())], "method", false, false, true, 2);
// line 3
echo " ";
$context["recommend_recipe_style"] = "related-recipe";
} else {
// line 5
echo " ";
$context["RecommendRecipe"] = twig_get_attribute($this->env, $this->source, $this->env->getFunction('repository')->getCallable()("Plugin\\Recipe\\Entity\\Recipe"), "getRecommendRecipe", [], "method", false, false, true, 5);
// line 6
echo " ";
$context["recommend_recipe_style"] = "recommend-recipe";
}
// line 8
echo "<link rel=\"stylesheet\" href=\"";
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("Recipe/assets/default/css/recipe.css", "plugin"), "html", null, true);
echo "\">
<script>
\$(window).on('load', function () {
//レシピ
const recipe = new Swiper(\".recipe-swiper\", {
loop: true,
slidesPerView: 1,
breakpoints: {
769: {
slidesPerView: 2
},
1024: {
slidesPerView: 3
}
},
spaceBetween: 18,
autoHeight: true,
navigation: {
nextEl: \".p-recipe .swiper-button-next\",
prevEl: \".p-recipe .swiper-button-prev\",
},
});
});
</script>
<section class=\"p-section p-recipe ";
// line 32
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed((isset($context["recommend_recipe_style"]) || array_key_exists("recommend_recipe_style", $context) ? $context["recommend_recipe_style"] : (function () { throw new RuntimeError('Variable "recommend_recipe_style" does not exist.', 32, $this->source); })()), 32, $this->source), "html", null, true);
echo "\">
<div class=\"inner\">
";
// line 34
if ((array_key_exists("recommend_recipe_title", $context) && !(null === (isset($context["recommend_recipe_title"]) || array_key_exists("recommend_recipe_title", $context) ? $context["recommend_recipe_title"] : (function () { throw new RuntimeError('Variable "recommend_recipe_title" does not exist.', 34, $this->source); })())))) {
// line 35
echo " <h2 class=\"p-title icon-top\"><span>";
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed((isset($context["recommend_recipe_title"]) || array_key_exists("recommend_recipe_title", $context) ? $context["recommend_recipe_title"] : (function () { throw new RuntimeError('Variable "recommend_recipe_title" does not exist.', 35, $this->source); })()), 35, $this->source), "html", null, true);
echo "</span></h2>
";
} else {
// line 37
echo " <h2 class=\"p-title icon-top\"><span>おすすめレシピ</span></h2>
";
}
// line 39
echo " ";
if ((array_key_exists("recommend_recipe_text", $context) && !(null === (isset($context["recommend_recipe_text"]) || array_key_exists("recommend_recipe_text", $context) ? $context["recommend_recipe_text"] : (function () { throw new RuntimeError('Variable "recommend_recipe_text" does not exist.', 39, $this->source); })())))) {
// line 40
echo " <p class=\"p-text\">";
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed((isset($context["recommend_recipe_text"]) || array_key_exists("recommend_recipe_text", $context) ? $context["recommend_recipe_text"] : (function () { throw new RuntimeError('Variable "recommend_recipe_text" does not exist.', 40, $this->source); })()), 40, $this->source), "html", null, true);
echo "</p>
";
}
// line 42
echo " <div class=\"recipe-slide\">
<div class=\"swiper recipe-swiper\">
<div class=\"swiper-wrapper\">
";
// line 45
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable((isset($context["RecommendRecipe"]) || array_key_exists("RecommendRecipe", $context) ? $context["RecommendRecipe"] : (function () { throw new RuntimeError('Variable "RecommendRecipe" does not exist.', 45, $this->source); })()));
foreach ($context['_seq'] as $context["_key"] => $context["Recipe"]) {
// line 46
echo " <div class=\"swiper-slide\">
<div class=\"p-recipe-box\">
<a href=\"";
// line 48
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getUrl("recipe_detail", ["id" => twig_get_attribute($this->env, $this->source, $context["Recipe"], "id", [], "any", false, false, true, 48)]), "html", null, true);
echo "\">
<div class=\"recipe-head\">
";
// line 50
if ((((( // line 51
array_key_exists("Product", $context) && twig_get_attribute($this->env, $this->source, // line 52
$context["Recipe"], "RecipeBadge", [], "any", true, true, true, 52)) && twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, // line 53
$context["Recipe"], "RecipeBadge", [], "any", false, true, true, 53), "name", [], "any", true, true, true, 53)) && !(null === twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, // line 54
$context["Recipe"], "RecipeBadge", [], "any", false, false, true, 54), "name", [], "any", false, false, true, 54))) && (twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, // line 55
$context["Recipe"], "RecipeBadge", [], "any", false, false, true, 55), "filename", [], "any", false, false, true, 55) != ""))) {
// line 56
echo " <div class=\"recipe-badge\">
<img
src=\"";
// line 58
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl($this->extensions['Eccube\Twig\Extension\EccubeExtension']->getNoImageProduct($this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["Recipe"], "RecipeBadge", [], "any", false, false, true, 58), "filename", [], "any", false, false, true, 58), 58, $this->source)), "save_image"), "html", null, true);
echo "\"
alt=\"";
// line 59
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["Recipe"], "RecipeBadge", [], "any", false, false, true, 59), "name", [], "any", false, false, true, 59), 59, $this->source), "html", null, true);
echo "\">
</div>
";
}
// line 62
echo " <img src=\"";
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl($this->extensions['Eccube\Twig\Extension\EccubeExtension']->getNoImageProduct($this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["Recipe"], "mainListImage", [], "any", false, false, true, 62), 62, $this->source)), "save_image"), "html", null, true);
echo "\" alt=\"\">
</div>
<div class=\"recipe-body\">
<h3 class=\"recipe-name\">";
// line 65
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["Recipe"], "name", [], "any", false, false, true, 65), 65, $this->source), "html", null, true);
echo "</h3>
";
// line 66
if ((twig_length_filter($this->env, twig_get_attribute($this->env, $this->source, $context["Recipe"], "RelatedProducts", [], "any", false, false, true, 66)) > 0)) {
// line 67
echo " <p class=\"recipe-product\">使用した商品:";
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["Recipe"], "RelatedProducts", [], "any", false, false, true, 67), 0, [], "array", false, false, true, 67), "ChildProduct", [], "any", false, false, true, 67), "name", [], "any", false, false, true, 67), 67, $this->source), "html", null, true);
echo "</p>
";
}
// line 69
echo " <div class=\"recipe-wrap\">
<p class=\"recipe-time\"><span>";
// line 70
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["Recipe"], "minute", [], "any", false, false, true, 70), 70, $this->source), "html", null, true);
echo "</span>分</p>
<p class=\"recipe-calorie\"><span>";
// line 71
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["Recipe"], "energy", [], "any", false, false, true, 71), 71, $this->source), "html", null, true);
echo "</span>kcal</p>
</div>
<ul class=\"recipe-tag-list\">
";
// line 74
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, $context["Recipe"], "tags", [], "any", false, false, true, 74));
foreach ($context['_seq'] as $context["_key"] => $context["tag"]) {
// line 75
echo " <li class=\"recipe-tag-item\">♯";
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["tag"], "name", [], "any", false, false, true, 75), 75, $this->source), "html", null, true);
echo "</li>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['tag'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 77
echo " </ul>
";
// line 78
if (array_key_exists("Product", $context)) {
// line 79
echo " <ul class=\"material-list\">
";
// line 80
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, $context["Recipe"], "materials", [], "any", false, false, true, 80));
foreach ($context['_seq'] as $context["_key"] => $context["material"]) {
// line 81
echo " <li class=\"material-item\">";
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["material"], "name", [], "any", false, false, true, 81), 81, $this->source), "html", null, true);
echo "</li>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['material'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 83
echo " </ul>
";
}
// line 85
echo " </div>
</a>
</div>
</div>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['Recipe'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 90
echo " </div>
</div>
<div class=\"swiper-button-prev\"></div>
<div class=\"swiper-button-next\"></div>
</div>
";
// line 95
if (( !array_key_exists("Product", $context) || (null === (isset($context["Product"]) || array_key_exists("Product", $context) ? $context["Product"] : (function () { throw new RuntimeError('Variable "Product" does not exist.', 95, $this->source); })())))) {
// line 96
echo " <div class=\"p-button orange\"><a href=\"";
echo $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getUrl("recipe");
echo "\">もっと見る</a></div>
";
}
// line 98
echo " </div>
</section>
";
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
}
public function getTemplateName()
{
return "Block/recommend_recipe.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 249 => 98, 243 => 96, 241 => 95, 234 => 90, 224 => 85, 220 => 83, 211 => 81, 207 => 80, 204 => 79, 202 => 78, 199 => 77, 190 => 75, 186 => 74, 180 => 71, 176 => 70, 173 => 69, 167 => 67, 165 => 66, 161 => 65, 154 => 62, 148 => 59, 144 => 58, 140 => 56, 138 => 55, 137 => 54, 136 => 53, 135 => 52, 134 => 51, 133 => 50, 128 => 48, 124 => 46, 120 => 45, 115 => 42, 109 => 40, 106 => 39, 102 => 37, 96 => 35, 94 => 34, 89 => 32, 61 => 8, 57 => 6, 54 => 5, 50 => 3, 47 => 2, 45 => 1,);
}
public function getSourceContext()
{
return new Source("{% if Product is defined %}
{% set RecommendRecipe = repository('Plugin\\\\Recipe\\\\Entity\\\\Recipe').getRecommendRecipe(Product) %}
{% set recommend_recipe_style = 'related-recipe' %}
{% else %}
{% set RecommendRecipe = repository('Plugin\\\\Recipe\\\\Entity\\\\Recipe').getRecommendRecipe() %}
{% set recommend_recipe_style = 'recommend-recipe' %}
{% endif %}
<link rel=\"stylesheet\" href=\"{{ asset('Recipe/assets/default/css/recipe.css' , 'plugin') }}\">
<script>
\$(window).on('load', function () {
//レシピ
const recipe = new Swiper(\".recipe-swiper\", {
loop: true,
slidesPerView: 1,
breakpoints: {
769: {
slidesPerView: 2
},
1024: {
slidesPerView: 3
}
},
spaceBetween: 18,
autoHeight: true,
navigation: {
nextEl: \".p-recipe .swiper-button-next\",
prevEl: \".p-recipe .swiper-button-prev\",
},
});
});
</script>
<section class=\"p-section p-recipe {{ recommend_recipe_style }}\">
<div class=\"inner\">
{% if recommend_recipe_title is defined and recommend_recipe_title is not null %}
<h2 class=\"p-title icon-top\"><span>{{ recommend_recipe_title }}</span></h2>
{% else %}
<h2 class=\"p-title icon-top\"><span>おすすめレシピ</span></h2>
{% endif %}
{% if recommend_recipe_text is defined and recommend_recipe_text is not null %}
<p class=\"p-text\">{{ recommend_recipe_text }}</p>
{% endif %}
<div class=\"recipe-slide\">
<div class=\"swiper recipe-swiper\">
<div class=\"swiper-wrapper\">
{% for Recipe in RecommendRecipe %}
<div class=\"swiper-slide\">
<div class=\"p-recipe-box\">
<a href=\"{{ url('recipe_detail', {'id': Recipe.id}) }}\">
<div class=\"recipe-head\">
{% if
Product is defined and
Recipe.RecipeBadge is defined and
Recipe.RecipeBadge.name is defined and
Recipe.RecipeBadge.name is not null and
Recipe.RecipeBadge.filename != '' %}
<div class=\"recipe-badge\">
<img
src=\"{{ asset(Recipe.RecipeBadge.filename|no_image_product, 'save_image') }}\"
alt=\"{{ Recipe.RecipeBadge.name }}\">
</div>
{% endif %}
<img src=\"{{ asset(Recipe.mainListImage|no_image_product, 'save_image') }}\" alt=\"\">
</div>
<div class=\"recipe-body\">
<h3 class=\"recipe-name\">{{ Recipe.name }}</h3>
{% if Recipe.RelatedProducts|length > 0 %}
<p class=\"recipe-product\">使用した商品:{{ Recipe.RelatedProducts[0].ChildProduct.name }}</p>
{% endif %}
<div class=\"recipe-wrap\">
<p class=\"recipe-time\"><span>{{ Recipe.minute }}</span>分</p>
<p class=\"recipe-calorie\"><span>{{ Recipe.energy }}</span>kcal</p>
</div>
<ul class=\"recipe-tag-list\">
{% for tag in Recipe.tags %}
<li class=\"recipe-tag-item\">♯{{ tag.name }}</li>
{% endfor %}
</ul>
{% if Product is defined %}
<ul class=\"material-list\">
{% for material in Recipe.materials %}
<li class=\"material-item\">{{ material.name }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
<div class=\"swiper-button-prev\"></div>
<div class=\"swiper-button-next\"></div>
</div>
{% if Product is not defined or Product is null %}
<div class=\"p-button orange\"><a href=\"{{ url('recipe') }}\">もっと見る</a></div>
{% endif %}
</div>
</section>
", "Block/recommend_recipe.twig", "/home/hirota-s.com/public_html/app/template/default/Block/recommend_recipe.twig");
}
public function checkSecurity()
{
static $tags = array("if" => 1, "set" => 2, "for" => 45);
static $filters = array("escape" => 8, "no_image_product" => 58, "length" => 66);
static $functions = array("repository" => 2, "asset" => 8, "url" => 48);
try {
$this->sandbox->checkSecurity(
['if', 'set', 'for'],
['escape', 'no_image_product', 'length'],
['repository', 'asset', 'url']
);
} catch (SecurityError $e) {
$e->setSourceContext($this->source);
if ($e instanceof SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
$e->setTemplateLine($tags[$e->getTagName()]);
} elseif ($e instanceof SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
$e->setTemplateLine($filters[$e->getFilterName()]);
} elseif ($e instanceof SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
$e->setTemplateLine($functions[$e->getFunctionName()]);
}
throw $e;
}
}
}