Skip to content

Instantly share code, notes, and snippets.

@dawehner
Created November 23, 2016 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dawehner/283fb5ab0dcd0ceefc88df9afc84e0ec to your computer and use it in GitHub Desktop.
Save dawehner/283fb5ab0dcd0ceefc88df9afc84e0ec to your computer and use it in GitHub Desktop.
@wimleers So what I was thinking was creating a render context, execute ```$item->processed``` in there, and then call ```$this->bubble($render_context->bubble());```
@wimleers
Copy link

What does

execute $item->processed
mean?

Either it exists, or it doesn't. When it doesn't exist, it's generated by \Drupal\text\TextProcessed::getValue(). When it does exist, it's a MarkupInterface instance, which doesn't allow cacheability metadata to be retrieved, nor does it allow "execution" of any way.

So, can you clarify?

@dawehner
Copy link
Author

dawehner commented Nov 23, 2016

$Item->processed is using the fieldapi magic, sorry, I should have made this clear.
If you "call" $item->processed, its called out \Drupal\text\TextProcessed to retrieve its value: \Drupal\text\TextProcessed::getValue ... which calls out to check_markup, which renders it using ::renderPlain.

So in case we would create a render context around this magic here, wouldn't we be able to catch the cacheability metadata from the render context?

@wimleers
Copy link

Ah! Yes, that's possible. Except in the case of $item->processed already having been generated. Then the magic wouldn't happen again, and we wouldn't be able to catch the cacheability metadata.

@wimleers
Copy link

Copied this discussion verbatim to https://www.drupal.org/node/2626924#comment-11795251, for future reference/to avoid linkrot.

Let's continue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment