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.39k stars 2.39k forks source link

Controller for the content picker field, add a content type parameter #15754

Open chinasqzl opened 5 months ago

chinasqzl commented 5 months ago

Contract parts, when you make up two different content types of purchase and sales contracts, the selected partner is different, and you need to read the settings of the contract parts under the content type to extend the IContentPickerResultProvider

Piedone commented 5 months ago

Please fill out the issue template (you can get it from here) fully, because I'm unclear on what your issue is about.

chinasqzl commented 5 months ago

Is your feature request related to a problem? Please describe.

public class ContractPart : ContentPart{ public ContentPickerField Partner { get; set; } = new(); } public class ContractPartSettings { public string Type { get; set; } //Sale or Purchase }

When the contract is a purchase, the partner is the supplier content type, and when it is a sale, the partner is the customer content type, and now ContentPickerAdminController.SearchContentItems() can only get the parts, but it can't get the parts of which content type, and it can't read the ContractPartSettings, so you can't do pickers for more scenarios

image

Describe the solution you'd like

Contract parts, when you make up two different content types of purchase and sales contracts, the selected partner is different, and you need to read the settings of the contract parts under the content type to extend the IContentPickerResultProvider

Describe alternatives you've considered

ContentPickerAdminController.SearchContentItems , Add the type parameter public async Task SearchContentItems(string type,string part, string field, string query)

image

Piedone commented 5 months ago

I think conceptually this is a similar issue to https://github.com/OrchardCMS/OrchardCore/issues/9444. I this for named/reusable parts?

chinasqzl commented 5 months ago

It's not the same, adding a type parameter, mainly for the ContentPickerAdminController.SearchContentItems() you can get the settings in the part, and pass in the IContentPickerResultProvider.Search(), the part is composed of multiple content types, and the settings in the part are not different

Piedone commented 5 months ago

Yeah, but isn't this something useful for named/reusable parts? Because GetPartDefinitionAsync(part).Fields will be the same as GetTypeDefinitionAsync(type).Parts.FirstOrDefault(p => p.Name == part).PartDefinition.Fields except for reusable parts.

chinasqzl commented 5 months ago

That's right, you need to add the parameters of the technical name of the part

github-actions[bot] commented 4 months ago

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.