Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/blacklight/document_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class DocumentComponent < Blacklight::Component

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

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

# Additional metadata sections
Expand Down
4 changes: 3 additions & 1 deletion app/components/blacklight/document_metadata_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ class DocumentMetadataComponent < Blacklight::Component

# @param fields [Enumerable<Blacklight::FieldPresenter>] Document field presenters
# rubocop:disable Metrics/ParameterLists
def initialize(fields: [], tag: 'dl', classes: %w[document-metadata dl-invert row], show: false, view_type: nil, field_layout: nil, **component_args)
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both document + presenter? Wouldn't presenter be sufficient as it's a wrapper around the document and thus we can get the document via presenter.document?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 we pass both to all the other subcomponents.

@fields = fields
@document = document # be consistent with other subcomponents.
@presenter = presenter # be consistent with other subcomponents.
@tag = tag
@classes = classes
@show = show
Expand Down