Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
複数カテゴリ検索プラグインで特定のカテゴリで検索されたときのみ検索項目を表示させる方法
{% if form.vars.value.category_ids|filter(c => c.id == 1)|length > 0 %}
{% set searchItem = repository("Plugin\\MultiCategorySearch4\\Entity\\SearchItem").find(1) %}
{% set value = 'search_item_' ~ searchItem.id %}
<dl>
<dd>
<div class="ec-blockCheckbox">
<label class="ec-label">{{ searchItem.name }}</label>
{% for i, item in form[value] %}
{{ form_widget(item, {'id': value~'_'~i~'_side'}) }}
{% endfor %}
</div>
</dd>
</dl>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment