[IMPLEMENTED] Dynamic block support

We are looking to possibility creating dynamic blocks like https://docs.magento.com/m2/ee/user_guide/cms/dynamic-blocks.html

Why: Now, when you have some website, you must hardcore content + blocks. But what if (for example) is homepage like this:

logo
carousel
paragraph title 1
text 1
image
paragraph title 2
text 2

Now, we must create “homepage” as single content and hardcode these elements. But what is somebody wants to add third paragraph, or put carousel bellow first paragraph? If there will be support for dynamic blocks, it will be possible.

Our proposal is to use current features. We propose to use “array” of undefined “relations”. For example I create scheme called page and hardcode only “title”/“id”,“meta” and put there entity “array” and allow to put there “reference” entity without scheme. Now this is possible and if you switch to content, it will looks like this:

So, maybe If we only allow to dynamically add reference to any existing entity, we can edit content and move dynamic content block.

Note: Using array is only hint how to achive with less programming, there is a better solution adding new data type called “dynamic block” of course.

Thanks for comments !

I am not sure if it makes sense, If the content is consumed by another consumer, such as an app or mobile view the arrangement might be totally different.

Why not implement it in your UI, as a react developer you have a great toolset for that: https://github.com/react-page/react-page

Yes, I understand, but Squidex is very powerful using GraphQL. And if Squidex is holder of page content & structure, you can download whole “page” scheme via graphQL, map it to react app components and dont care about page structure. You will become a real “content” builder, instead of only “hardcoded input filler”.

I see, but I am not sure, if a schema is what you want for that.

Two reasons:

  • No WYSIWYG
  • Very often you do not want to select content items. Instead you have business requirements like:
    • Show me the 3 newest articles +
    • Show me the a selected main article +
    • Show me the latest blog posts

Sorry, but I am not sure, if we are talking about the same functionality. Dynamic blocks allows you to dynamically create page content + page structure/layout. You are talking about usecases/BRQs about working with entitites.

Maybe imagine this usecase: You want to create website. There are similar pages except homepage and contact page. Each page has metadata (a lot of :)) and two paragraphs and two headings. Now I must create these entities:

  • homepage (single content)
  • contanct page (single content)
  • page (multiple content)

In these entities i have duplicit schema. In react application, programator must prepare three page types and ask three different ways for content using GraphQL.

So, this is reason, where dynamic blocks can help, because entity will be only one - PAGE (multiple content). And I create homepage and plug there dynamic block, contact page with another dynamic blok and other pages will contain the same content. React developer dont care about page type, because he map GraphQL content to widgets.

Best,

How would it look like in graphql? Graphql is typed. Is there a concept of inheritance?

Good news. I am working on it. Will be released next week. Will post some screenshot not later than Monday.

Cool :slight_smile: We are looking forward… :slight_smile:

1 Like

Hi,

here is how it works:

The reference field

The reference field has been updated to support multiple reference schemas:

  • Single schema is selected: Same behavior as of now.
  • Multiple schemas selected: You can only reference the selected schemas.
  • No schemas selected: You can reference all other content items.

The content selector

Base on the selected schemas you can switch to another schema in the top left part of the selector:

The references UI

The references UI show the schema name now and supports content items with different number of reference columns.

GraphQL

If you have selected a single schema, nothing changes. If you have selected multiple schemas or no schemas a union type with an interface is created, e.g.:

query {
  findMySchemaContent(id: '12345') {
	id
	data {
	  myUnion {
		iv {
		  ... on Content { // The interface.
			id
		  }
		  ... on MyRefSchema1 {
			data {
			  ref1Field {
				iv
			  }
			}
		  }
		  __typename
		}
	  }
	}
  }
}
1 Like

When or how is this functionality available?

It is available in the dev build and probably in the cloud today.

It is not updated yet in the cloud right? Is there an update on when this will be available in the cloud?

Wednesday, same time.