🐛 [i2925] - Fix flexible form to use resource contexts for schema field inclusion copy#7348
Closed
ShanaLMoore wants to merge 2 commits intomainfrom
Closed
🐛 [i2925] - Fix flexible form to use resource contexts for schema field inclusion copy#7348ShanaLMoore wants to merge 2 commits intomainfrom
ShanaLMoore wants to merge 2 commits intomainfrom
Conversation
Pass resource.contexts (plural) into form_definitions_for so context-specific metadata profile properties (e.g. dimensions for special_context) appear on the work form when the admin set has that context assigned.
There was a problem hiding this comment.
Pull request overview
Fixes Hyrax flexible metadata forms so context-restricted properties from the M3 metadata profile are included on work forms when the work/admin set has matching contexts.
Changes:
- Update
Hyrax::Forms::ResourceForminitialization to passresource.contexts(plural) intom3_schema_loader.form_definitions_for. - Ensure schema-driven form field inclusion respects context filtering in
Hyrax::M3SchemaLoader.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Test Results 13 files ±0 13 suites ±0 2h 51m 6s ⏱️ - 2m 3s Results for commit 423b002. ± Comparison against base commit 56a94e3. This pull request removes 359 and adds 359 tests. Note that renamed tests count towards both. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
Summary
Bug: With HYRAX_FLEXIBLE=true, context-specific properties from the metadata profile (e.g. “dimensions” for special_context) do not appear on the work form even when the work’s admin set has that context assigned.
Cause: In Hyrax::Forms::ResourceForm#initialize, the form uses r.context (singular) to pass to form_definitions_for; the resource only has r.contexts (plural), so contexts is always nil and M3SchemaLoader omits all context-restricted properties.
PS. 5.0-flexible has it as a plural reference as well
Changes proposed in this pull request:
Fix: In resource_form.rb, use the resource’s contexts (plural) when calling form_definitions_for (e.g. context = r.respond_to?(:contexts) ? r.contexts : nil and pass it as contexts: context), so the form includes properties for the work’s context(s), e.g. “dimensions” for admin sets with “special context.”
@samvera/hyrax-code-reviewers
metadata-profile-v.7 (1).yml
BEFORE
dimensions was missing from an ImageResource work created from the 'special context' admin set
AFTER