Open benglass opened 11 years ago
i think we really should extend the handling of the current filter rather than add a second filter. so a PR would be appreciated. (though i want to only merge that after 1.0 is tagged stable, this would go into 1.1 - if we keep adding features we will never see a stable release. really sorry about that)
checking if this was a block id and fall back to cmf sounds good to me.
for the parameter format, the &
seem a tricky choice. vertical bars could be nice, but they might be hard to find on a keyboard for non-coders. maybe we can steal that from some wiki that has a nice syntax?
It would be good to be able to embed a standard sonata block service that is not stored in PHPCR into a PHPCR document's content area so it is handled by cmf_embed_blocks or a similar twig filter.
The use case would be if you want to show 3 featured products from a product database on the home page. You could embed a product block service (service id sonata.block.service.project in this example) in the content using syntax like
Additionally you would want to be able to specify options to the embedded block so you could tell it you want to show only featured projects and limit it to 3
I'm not sure how useful the options would be for the cmf stored blocks but it seems like there could be a use case.
I already have a working example of this in a completely separate filter which is based on the cmf_embed_blocks filter. I would be interested in hearing from folks about
Should it be a separate twig filter or supported by the existing one?
Since the syntax would be the same except we'd have to determine whether we are dealing with a service id or a path which should be a matter of simply asking sonata block's BlockManager if it has/supports a block with that service id and if not fall back to current behavior of loading from cmf. Additionally not requiring 2 filters to be executed seems to be a performance gain.