Closed pxwee5 closed 6 years ago
Hi @pxwee5,
We removed this part of the code since it results in duplication of data and a maintenance responsibility of the system to keep it up to date.
It was (as far as I can tell) primarily used in the SS3 version of elemental to support search indexing. We have replaced this with an example ElementalSolrIndex
class which uses ElementalPageExtension::getElementsForSearch()
dynamically to render the block content for use in search indexing.
Do you have another reason you'd need it?
Related: https://github.com/dnadesign/silverstripe-elemental/issues/116
Closing as this isn't a bug.
Cheers!
Thinking of temporarily using it so that I can use GraphQL to query the Content field while waiting for Elemental Blocks to support GraphQL.
Ok I see. My suggestion would be to expose getElementsForSearch
in your GraphQL configuration for now, assuming you want to expose the data under the guide of it belonging to the page rather than as an accurately nested data structure?
Ideally I would prefer to have nested data structure from the GraphQL so that the frontend can have the flexibility to consume the data however it likes. But this is in the roadmap I believe.
So that next best option (I thought) was copy_element_content_to_content
, but that's deprecated in 2.0.
getElementsForSearch
returns html stripped strings for search, it's probably not suitable for frontend because I need to render the html tags in ElementHolder and MyElement as well.
The closest I've got is to replicate copy_element_content_to_content
so that I can do them onBeforeWrite
. Then expose the Content field in GraphQL. I guess that's my only option?
You can always define your own GraphQL scaffolding for the elements on a page using YAML configuration. I’d suggest that personally.
@robbieaverill Do you have an example on how to configure your YAML config? At this very moment I'm not even convinced that GraphQL in SilverStripe 100% works.
@pxwee5 sure - there's pretty extensive documentation in the GraphQL readme: https://github.com/silverstripe/silverstripe-graphql#exposing-a-dataobject-to-graphql
Yeah I've been on top of that documentation since last week.
I know this is not an Elemental question. But have you ever managed to get the args
/ addArgs
in your GraphQL scaffolding to work?
There's an example of doing that here: https://github.com/silverstripe/silverstripe-graphql#adding-arguments
Is
copy_element_content_to_contentfield
supported in the elemental version in SS4?I don't see it in
ElementPageExtension.php
.