Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add guard clauses to support Hyrax Flexible Metadata #363

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
6 changes: 3 additions & 3 deletions lib/iiif_print/persistence_layer/valkyrie_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ def self.object_ordered_works(object)
# @param work_type [Class<Valkyrie::Resource>]
# @return the indexer for the given :work_type
def self.decorate_with_adapter_logic(work_type:)
work_type.send(:include, Hyrax::Schema(:child_works_from_pdf_splitting)) unless work_type.included_modules.include?(Hyrax::Schema(:child_works_from_pdf_splitting))
work_type.send(:include, Hyrax::Schema(:child_works_from_pdf_splitting)) unless Hyrax.config.flexible? || work_type.included_modules.include?(Hyrax::Schema(:child_works_from_pdf_splitting))
# TODO: Use `Hyrax::ValkyrieIndexer.indexer_class_for` once changes are merged.
indexer = "#{work_type}Indexer".constantize
indexer.send(:include, Hyrax::Indexer(:child_works_from_pdf_splitting)) unless indexer.included_modules.include?(Hyrax::Indexer(:child_works_from_pdf_splitting))
indexer.send(:include, Hyrax::Indexer(:child_works_from_pdf_splitting)) unless Hyrax.config.flexible? || indexer.included_modules.include?(Hyrax::Indexer(:child_works_from_pdf_splitting))
indexer
end

Expand All @@ -33,7 +33,7 @@ def self.decorate_with_adapter_logic(work_type:)
# @return form for the given :work_type
def self.decorate_form_with_adapter_logic(work_type:)
form = "#{work_type}Form".constantize
form.send(:include, Hyrax::FormFields(:child_works_from_pdf_splitting)) unless form.included_modules.include?(Hyrax::FormFields(:child_works_from_pdf_splitting))
form.send(:include, Hyrax::FormFields(:child_works_from_pdf_splitting)) unless Hyrax.config.flexible? || form.included_modules.include?(Hyrax::FormFields(:child_works_from_pdf_splitting))
form
end

Expand Down
Loading