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

🐛 Create admin set of configured type #6701

Merged
merged 1 commit into from
Feb 19, 2024
Merged
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
8 changes: 6 additions & 2 deletions app/services/hyrax/admin_set_create_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,16 @@ def save_default?
# Create an instance of `Hyrax::AdministrativeSet` with the suggested_id if supported.
# @return [Hyrax::AdministrativeSet] the new admin set
def create_admin_set(suggested_id:, title:)
# Leverage the configured admin class, if it is a Valkyrie resource, otherwise fallback.
# Until we have fully moved to Valkyrie, we will need this logic. Once past, we can
# use `Hyrax.config.admin_set_class`
klass = Hyrax.config.admin_set_class < Valkyrie::Resource ? Hyrax.config.admin_set_class : Hyrax::AdministrativeSet
if suggested_id.blank? || Hyrax.config.disable_wings
# allow persister to assign id
Hyrax::AdministrativeSet.new(title: Array.wrap(title))
klass.new(title: Array.wrap(title))
else
# use suggested_id
Hyrax::AdministrativeSet.new(id: suggested_id, title: Array.wrap(title))
klass.new(id: suggested_id, title: Array.wrap(title))
end
end

Expand Down