Skip to content

Commit 1a82747

Browse files
committed
Opt out of calling back into helper methods if the item component method is provided
1 parent bed12bb commit 1a82747

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/components/blacklight/facet_item_component.rb

+9-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ def with_view_context(view_context)
4444
# @deprecated
4545
# @private
4646
def overridden_helper_methods?
47+
return false if explicit_component_configuration?
48+
4749
@view_context.method(:render_facet_item).owner != Blacklight::FacetsHelperBehavior ||
4850
@view_context.method(:render_facet_value).owner != Blacklight::FacetsHelperBehavior ||
4951
@view_context.method(:render_selected_facet_value).owner != Blacklight::FacetsHelperBehavior
@@ -103,10 +105,16 @@ def render_selected_facet_value
103105
# @return [String]
104106
# @private
105107
def render_facet_count(options = {})
106-
return @view_context.render_facet_count(@hits, options) unless @view_context.method(:render_facet_count).owner == Blacklight::FacetsHelperBehavior
108+
return @view_context.render_facet_count(@hits, options) unless @view_context.method(:render_facet_count).owner == Blacklight::FacetsHelperBehavior || explicit_component_configuration?
107109

108110
classes = (options[:classes] || []) << "facet-count"
109111
content_tag("span", t('blacklight.search.facets.count', number: number_with_delimiter(@hits)), class: classes)
110112
end
113+
114+
private
115+
116+
def explicit_component_configuration?
117+
@facet_item.facet_config.item_component.present?
118+
end
111119
end
112120
end

0 commit comments

Comments
 (0)