OrchardCore icon indicating copy to clipboard operation
OrchardCore copied to clipboard

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

Open chinasqzl opened this issue 1 year ago • 7 comments

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

chinasqzl avatar Apr 15 '24 01:04 chinasqzl

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

Piedone avatar Apr 15 '24 13:04 Piedone

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<IActionResult> SearchContentItems(string type,string part, string field, string query)

image

chinasqzl avatar Apr 16 '24 03:04 chinasqzl

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

Piedone avatar Apr 16 '24 13:04 Piedone

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

chinasqzl avatar Apr 17 '24 01:04 chinasqzl

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.

Piedone avatar Apr 17 '24 15:04 Piedone

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

chinasqzl avatar Apr 18 '24 07:04 chinasqzl

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.

github-actions[bot] avatar May 23 '24 23:05 github-actions[bot]