OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.45k stars 2.41k forks source link

Placement is not applied for the label of the named part #17058

Open barthamark opened 1 week ago

barthamark commented 1 week ago

Describe the bug

I have a content type with a named BagPart. I want to put the BagPart editor to a separate tab. I can do it with the following placement:

"BagPart_Edit": [
      {
        "place": "Parts:3#My Tab",
        "differentiator": "Items"
      }
]

It successfully creates the tab and puts the "Add My Type" to the "My Tab", but it leaves the "Items Provides a collection behavior for your content item where you can place other content items." text on the "Content" tab.

I see that this text is generic and implemented in the ContentPart.Edit.cshtml but I have no idea on how to address this shape from the placement, nothing seem to target it.

Orchard Core version

2.0.2

To Reproduce

  1. Create two content types: Inner (doesn't matter what parts), Outer (add a named BagPart containing Inner content items, the name should be Items)
  2. Go to Design > Placements and create a Placement with shape type BagPart_Edit and the rule should be
    [
      {
        "place": "Parts:3#My Tab",
        "differentiator": "Items"
      }
    ]
  3. Create a new Outer item
  4. See that the Content tab has the generic "Items ..." text and the "My Tab" has the actual editor.

Expected behavior

Somehow move the generic text to the "My Tab" tab.

Logs and screenshots

image image

ns8482e commented 6 days ago

I recall this! For namedpart don't use BagPart_Edit in placement, it will only move the Part and not the label. To move both label and the Part use ContentPart_Edit in placement with differentiator.

Try something like

{
  "ContentPart_Edit": [
    {
      "place": "Parts#HTML Attributes",
      "differentiator": "Container-BackgroundColor",
      "contentType": ["Container"],
      "contentPart": ["BootstrapColor"]
    }
  ]
}