Skip to content

Commit ea02c7a

Browse files
committed
Pass document + presenter through to DocumentMetadataComponent.
1 parent 3e3e63c commit ea02c7a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/components/blacklight/document_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class DocumentComponent < Blacklight::Component
5555

5656
component ||= view_config.metadata_component || Blacklight::DocumentMetadataComponent
5757

58-
component.new(*args, fields: fields || @presenter&.field_presenters || [], **kwargs)
58+
component.new(*args, document: @document, presenter: @presenter, fields: fields || @presenter&.field_presenters || [], **kwargs)
5959
end)
6060

6161
# Additional metadata sections

app/components/blacklight/document_metadata_component.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ class DocumentMetadataComponent < Blacklight::Component
99

1010
# @param fields [Enumerable<Blacklight::FieldPresenter>] Document field presenters
1111
# rubocop:disable Metrics/ParameterLists
12-
def initialize(fields: [], tag: 'dl', classes: %w[document-metadata dl-invert row], show: false, view_type: nil, field_layout: nil, **component_args)
12+
def initialize(fields: [], document: nil, presenter: nil, tag: 'dl', classes: %w[document-metadata dl-invert row], show: false, view_type: nil, field_layout: nil, **component_args)
1313
@fields = fields
14+
@document = document # be consistent with other subcomponents.
15+
@presenter = presenter # be consistent with other subcomponents.
1416
@tag = tag
1517
@classes = classes
1618
@show = show

0 commit comments

Comments
 (0)