1
このようなロジックをTwig 2.xに変換するにはどうしたらいいですか?Twig complex array conversion
<?php if (isset($pricerunner_category[$category['category_id']])) { echo $pricerunner_category[$category['category_id']]; } ?>
このようなロジックをTwig 2.xに変換するにはどうしたらいいですか?Twig complex array conversion
<?php if (isset($pricerunner_category[$category['category_id']])) { echo $pricerunner_category[$category['category_id']]; } ?>
attribute
機能で可能である必要があります。
https://twig.symfony.com/doc/2.x/functions/attribute.html
{% if attribute(pricerunner_category, category.category_id) is defined %}
{{ attribute(pricerunner_category, category.category_id) }}
{% endif %}
ないis defined
が必要であるかどう必ず、ドキュメントに基づいてこれを追加しました。