Developer forum

Forum » CMS - Standard features » What is the best way of passing a pageitem field value to a paragraph item field value?

What is the best way of passing a pageitem field value to a paragraph item field value?

Hans Ravnsfjall
Hans Ravnsfjall
Reply

When creating a paragraph item on a page, I want to inherit or pass a value from the pageitem that the paragraph is created on.

Question 1 - What is the best way? Is there a way to inherit a valure, or somehow passing it to the paragraph when it is created.

As it is now, the way I can make it is to have a select field, where I select the pageitem when the paragraphitem is created. But that is not very logical. Once you create the paragraph on a page, I as a user would expect there to be a relation between the paragraph item and the pageitem. It would seem dumb to have to select the pageitem, right after you just created the paragraph on that exact same page.

Question 2 - Everything that is shown, will be shown as an index. Is there perhaps a way to accumelate the entira data on a page in one query (Entire page meaning the page, the pageitem, the paragraphs and the items attached to them )?

Question 3 - All the paragraphitems will  be the same type. And the index query will typically look up on a value from one of the fields on a paragraph item. Will i be able to display value from the pageitem, when looking up a child paragraphitem ?

 

/Hans


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Hans,

 

  1. Is this by creating Items in the backend or frontend?
    1. If backend, then I don't know you can, but I wonder if you have to. What's the use case?
    2. If frontend (Item Creator), you should be able to get tags, Model properties or API methods to get that
       
  2. Using the query publisher maybe? Or the Item publisher?
     
  3. You should. Worst case scenario you can develop an IndexBuilderExtender to make sure you have the necessary data (which could also be the answer for question 1)

 

Best Regards,

Nuno Aguiar

 

You must be logged in to post in the forum