Loading src/Plugin/Block/TwitterBlockBase.php +6 −4 Original line number Diff line number Diff line Loading @@ -333,10 +333,12 @@ class TwitterBlockBase extends BlockBase implements ContainerFactoryPluginInterf * Render Tweets. */ public function displayTweets(array $embed) { $build = []; foreach ($embed as $tweet) { $build[] = ['#markup' => $tweet['html']]; } $build[] = [ '#theme' => 'twitter_api_block_tweets', '#embeds' => $embed ]; return $build; } Loading templates/twitter-api-block-tweets.html.twig 0 → 100644 +14 −0 Original line number Diff line number Diff line {# /** * @file * Default theme implementation for the Twitter API display tweets method. * * Available variables: * - embeds: An array of embeds. * * @ingroup themeable */ #} {% for item in embeds %} {{ item.html|raw }} {% endfor %} twitter_api_block.module 0 → 100644 +19 −0 Original line number Diff line number Diff line <?php /** * @file * Contains hook implementations for twitter_api_block. */ /** * Implements hook_theme(). */ function twitter_api_block_theme() { return [ 'twitter_api_block_tweets' => [ 'variables' => [ 'embeds' => NULL, ], ], ]; } Loading
src/Plugin/Block/TwitterBlockBase.php +6 −4 Original line number Diff line number Diff line Loading @@ -333,10 +333,12 @@ class TwitterBlockBase extends BlockBase implements ContainerFactoryPluginInterf * Render Tweets. */ public function displayTweets(array $embed) { $build = []; foreach ($embed as $tweet) { $build[] = ['#markup' => $tweet['html']]; } $build[] = [ '#theme' => 'twitter_api_block_tweets', '#embeds' => $embed ]; return $build; } Loading
templates/twitter-api-block-tweets.html.twig 0 → 100644 +14 −0 Original line number Diff line number Diff line {# /** * @file * Default theme implementation for the Twitter API display tweets method. * * Available variables: * - embeds: An array of embeds. * * @ingroup themeable */ #} {% for item in embeds %} {{ item.html|raw }} {% endfor %}
twitter_api_block.module 0 → 100644 +19 −0 Original line number Diff line number Diff line <?php /** * @file * Contains hook implementations for twitter_api_block. */ /** * Implements hook_theme(). */ function twitter_api_block_theme() { return [ 'twitter_api_block_tweets' => [ 'variables' => [ 'embeds' => NULL, ], ], ]; }