During the draft_to_publish hook in my setup.php, I am running post content through a translation API to translate the content into various langauges. This is working OK when using
WP’s post->post_content. Indeed the content of the blog is translated.
However, this method is not necessarily translating everything I want on the page. For example, we render the category of the posts, the publication date and other data. In my layout, those sections are part of my yielded content and should be translated as well but they are not when using post->post_content.
BUT when I use the translation filter in the layout template file on $__env->getSection(‘content’), it translates everything I need on the page.
Therefore it seems that I needed to retrieve the yielded content from setup.php, but using $__env is undefined in that context.
Any idea how to retrieve the yielded content from a layout file in Sage 9? I know \App\template(‘layouts.app’) will return the entire file as a string, but I only want the yielded content.