-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Placement rules for shape types that include a double underscore are applied incorrectly #17367
Comments
What if this was not a bug. The placement file is indexed on shape types, so The base logic to strip the But I might be wrong, do you think the other issues prove that it's not the case? |
We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues). This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here. |
@sebastienros, yes, I agree that the code indicates that the base logic to strip the Now, would it be fair to say, more generally, that shape types shouldn't include Would is also be reasonable to proactively rename the |
Before I answer, can you confirm that the discriminator would work without you needing to wrap the shapes? |
Knowing that the
Using the
|
Describe the bug
This came up while I was investigating #10958. I discovered that the BaseDisplayManager ignores everything after the
__
(double underscores) delimiter. Orchard defines several shapes that include this delimiter (e.g.CommonPart_Edit__Date
,CommonPart_Edit__Owner
).If, for example, I wanted move the Owner field above the date field, I'd expect to be able to write the following placement rules:
However, if I do this, the shape type for both rules gets evaluated as
CommonPart_Edit
, so both shapes end up being in the content zone in position 10.Note that creating placements via the admin placements feature would likely exhibit the same issue, if not blocked by #10958.
Orchard Core version
commit 2d49b61
To Reproduce
Placement File
"place": "-"
)."place": "Content:before"
).Expected behavior
Shapes should be able to controlled independently using placement rules.
While I believe the behavior of stripping out everything after the delimiter is intentional, per #4484, it's problematic when a shape includes the double underscores and it's not delimiting the display mode modifier.
Note that, in my example, Orchard Core does set a differentiator, so an omniscient developer could strip everything after the delimiter in the placement and use that as the shape type and, instead, specify the differentiator, but that's not really documented and it I'm not sure that that's the intended behavior. This is documented specifically for field display modes per #17333, but this scenario is different in that we're not using display modes.
A developer using Orchard Core could run into this scenario by creating a new driver that returns a combined result with shapes
Foo__A
andFoo__B
. Then, I don't believe the differentiator would be available when resolving the placement, and thus the developer could not use placement on those shapes independently.Similarly, say we wanted to refactor
SearchController.Search
to, rather than using adhoc shapes, use the display manager to build the page using the sameSearch__Form
,Search__List
, andSearch__Results
search results page. Those shape names all include the delimiter so we would be unable to use placement to individually control the placement of those shapes.Should the __ delimiter in a shape type be reserved strictly for use by display modes?
Logs and screenshots
The text was updated successfully, but these errors were encountered: