public function JuicerEmbedFeedBlock::build in Juicer - Social Media Feed Aggregator 8
Builds and returns the renderable array for this block plugin.
If a block should not be rendered because it has no content, then this method must also ensure to return no content: it must then only return an empty array, or an empty array with #cache set (with cacheability metadata indicating the circumstances for it being empty).
Return value
array A renderable array representing the content of the block.
Overrides BlockPluginInterface::build
See also
\Drupal\block\BlockViewBuilder
File
- src/
Plugin/ Block/ JuicerEmbedFeedBlock.php, line 179
Class
- JuicerEmbedFeedBlock
- Provides a Juicer embed block.
Namespace
Drupal\juicerio\Plugin\BlockCode
public function build() {
$delta = $this
->getDerivativeId();
if ($this->configuration[$delta . '_feed_id']) {
$juicer_feed_id = $this->configuration[$delta . '_feed_id'];
}
else {
$juicer_feed_id = $this->configFactory
->get('juicerio.settings')
->get('juicer_feed_id');
}
// Permit the alternative JS library to be attached here [#2917855].
$juicer_library = $this->configFactory
->get('juicerio.settings')
->get('juicer_js_embed');
return [
'#theme' => 'juicerio_feed',
'#feed_id' => $juicer_feed_id,
'#post_num' => $this->configuration[$delta . '_post_number'],
'#infinite_pages' => $this->configuration[$delta . '_infinite_pages'],
'#gutter_amt' => $this->configuration[$delta . '_gutter_amt'],
'#column_num' => $this->configuration[$delta . '_column_number'],
'#filters' => $this->configuration[$delta . '_filter'],
'#attached' => [
'library' => [
'juicerio/' . $juicer_library,
'juicerio/juicerio.styles',
],
],
];
}