Skip to content
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

Data Picker Context #442

Open
1 task done
IOSven opened this issue Jan 10, 2025 · 1 comment
Open
1 task done

Data Picker Context #442

IOSven opened this issue Jan 10, 2025 · 1 comment
Assignees
Labels
type/feature-request New feature request

Comments

@IOSven
Copy link

IOSven commented Jan 10, 2025

Which Contentment version are you using?

V5.1.0

Which Umbraco version are you using? For example: 13.2.1 - don't just write v13

V13.5.2

Bug summary

Hi!

We have a document type named 'contentpage'.
On this contentpage, we've added a tab 'taxonomies' through a composition.

In this tab, an MNTP has been added where the following document type can be chosen:

  • Product detail page

This composition is added to every document type used as a page, as well as some content blocks used in a Umbraco.BlockList, such as the 'FAQ Block'.

This blocklist can be added on various document types. In this example we'll be adding this content block to our 'Contentpage' document type.

Example:

FAQ Item A:

  • Taxonomies tab: Product detail page nr1 (Picked in the MNTP, which is added through the composition 'taxonomies')
    image

Contentpage A:

  • Taxonomies tab: Product detail page nr1 (Picked in the MNTP)
    image

  • FAQ Block: In the content blocks property, I add the 'FAQ Block'. On this block, I can also add taxonomies, as it also uses the same 'taxonomies' composition.

    • In the FAQ Block, I have created a custom Contentment data picker. In this custom data picker, I want to retrieve all related content based on the choice in the taxonomies tab on contentpage A (Not the choice on this block (yet :-) )

image

I can retrieve this information by using the ContentmentContentContext with which I can get the current page and thus also the choice of taxonomy (after publishing).

Issue/Question 1:

What I'm currently missing here is the culture for which I want to retrieve the list of related items.
In #397 you indicate that this is not possible for the Contentment data list, but I was wondering if this is possible for the data picker, as it loads itself when clicking the 'ADD' button.

In a previous Umbraco 8 project, we managed to bypass this issue by retrieving the mculture/cculture in a custom .js interceptor.

Issue/Question 2

As I've already indicated above, the 'taxonomies' composition is also added to the 'FAQ Block' content block.
image

In the previous step, I would like to retrieve related content based on a choice at the page level.

In this step, I would like to populate the data picker list based on the choice in the 'taxonomies' composition at block level.
The problem here is that the ContentmentContentContext has no information about the block we are editing at that moment.

So my question is whether it would be possible to get context about the content block you are editing in a custom data picker data source.

Steps to reproduce

Simpler example:

  1. Clean Umbraco v13.5.2 install

  2. Clean Contentment v5.1.0 install

  3. Create document types (for testing purposes, allow them to be added to the root as content):
    Contentpage

  4. Create element type 'FAQ Block':

  • Add custom contentment data picker
  • Add this element type to a Umbraco.Blocklist data type & add this to the 'ContentPage'
  1. Create pages:
  • Create contentpage, add the FAQ Block
  • Debug the custom data picker. We are not able to retrieve any context about the culture OR the FAQ Block itself.

Expected result / actual result

No response

Do you have Umbraco ModelsBuilder enabled?

  • Yes, it is enabled.

What browsers are you seeing the problem on?

No response

@leekelleher leekelleher added the type/feature-request New feature request label Jan 17, 2025
@leekelleher
Copy link
Owner

@IOSven Thanks for the info.

Working through the exposition, am I correct in thinking the 2 feature requests for Data Picker are:

  1. Add culture/variant parameters to the API endpoints.

  2. Add block data to the API endpoint and access that within ContentmentContentContext.
    Does that sound right?

My initial thoughts on these are...

  1. Yes, that's definitely possible, but I'd need to review whether that'd be a breaking-change or not.

  2. I honestly have no idea how this would work, since Block data is effectively a JSON blob, it'd mean sending more data in the API request payload. It feels quite heavy to do this in a generic way (so that it can support a wider set of Contentment users).
    I'm open to ideas/suggestions, but also wondering whether your requirements would be better suited to a bespoke property-editor? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature-request New feature request
Projects
None yet
Development

No branches or pull requests

2 participants