Skip to content

What is correct way to get block strings now? #650

Answered by colinodell
Niklan asked this question in Q&A
Discussion options

You must be logged in to vote

Previously in my block renderer, I was using $strings = $block->getStrings();, now this method is gone and I don't see it in the changelog.

My apologies, it looks like I forgot to document this change. I will fix this ASAP.

Basically, you'll want to make these changes:

  1. Have your MetaInformationElement class extend from AbstractStringContainerBlock instead of AbstractBlock
  2. Override its finalize() method to set the final contents like $this->finalStringContents = implode("\n", $this->strings);
  3. Call the getStringContent() method in your renderer to get those finalized string contents

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by colinodell
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question General questions about the project or usage
2 participants
Converted from issue

This discussion was converted from issue #358 on June 12, 2021 14:03.