Score:0

How to access Block Layout data and add to render array for rendering in a Twig template?

gl flag

I'm a relatively new Drupal developer, and this ticket for my job has been proving extremely difficult for me to figure out through research.

I want to access the block layout data (/admin/structure/block/manage/block_name_example?destination=/admin/structure/block) for a custom block that we're using for our hero page banner. We're using the Block Scheduler plugin, which provides an Expiry tab to set the Publish and Expiry date for blocks. This banner usually contains a sale, and instead of adding a new field to the Block and setting the expiry date in two places, we're wanting to simply pull the date that we set in that Expiry tab.

Here's a visual representation of the field we want to access by passing the data to theme's render array for use within a designated Twig template for this block:

enter image description here

Any help would be greatly appreciated!

id flag
What have you tried so far?
user111115 avatar
gl flag
I haven't tried anything yet, because I don't know what specific API or functionality I would even need to use to meet the requirements I've outlined above.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.