I’m writing a plugin that needs to export the site content in the base language and pull everything that needs to be translated in a JSON file.
I can loop through
$site fields and all of its children’s fields, but I face an issue. I want to exclude fields that have type
image, for example, or fields that explicitly have
translate set to
How would I do that?
I want that information to be accessible via an endpoint, for example
http://localhost/mysite/content. This means I’ve configured a route and I need to extract the information in the route handler.
I’ve read Generating JSON with Kirby, but it does a different thing.
Another question needed something similar and perhaps the answer is the same? The difference is that I want to access that information from a route handler and not a site template. Quoting lukasbestle:
If you need that information though, you can manually get the path to the blueprint by using
kirby()->roots->blueprints() . DS . $page->template() . '.php'and use
Yaml::read()with that filename to parse the blueprint.
Is that the only way?