public function FacebookBoxesFollowBlock::build in Facebook Boxes 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/ FacebookBoxesFollowBlock.php, line 113 - Contains \Drupal\facebook_boxes\Plugin\Block\FacebookBoxesFollowBlock
Class
- FacebookBoxesFollowBlock
- Provides the Facebook Follow block.
Namespace
Drupal\facebook_boxes\Plugin\BlockCode
public function build() {
$url = $this->configuration['fb_follow_url'];
$layout = $this->configuration['fb_follow_layout'];
$showfaces = $this->configuration['fb_follow_showface'] ? 'TRUE' : 'FALSE';
$width = preg_replace('/[^\\d\\s]/', '', $this->configuration['fb_follow_width']);
$out = array();
$out[] = '<iframe src="http://www.facebook.com/plugins/follow.php?href=' . $url;
$out[] = '&layout=' . $layout;
if ($layout == 'standard') {
$out[] = '&show_faces=' . $showfaces;
}
$out[] = '&colorscheme=' . $this->configuration['fb_follow_color'];
$out[] = '&font=' . $this->configuration['fb_follow_font'];
$out[] = '&width=' . $width;
$out[] = '&height=80" scrolling="no" frameborder="0" ';
$out[] = 'style="border:none; overflow:hidden; width:' . $width;
$out[] = ';height:80px; "allowTransparency="true"></iframe>';
return array(
'#type' => 'markup',
'#markup' => implode('', $out),
);
}