Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Created July 6, 2021 06:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurozumi/840e8c54195b409734448a7d04e5f2c1 to your computer and use it in GitHub Desktop.
Save kurozumi/840e8c54195b409734448a7d04e5f2c1 to your computer and use it in GitHub Desktop.
複数カテゴリ検索プラグインで特定のカテゴリで検索されたときのみ検索項目を表示させる方法
{% 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