public function SocialPostPostForm::render in Open Social 10.1.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
- 8 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
- 8.2 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
- 8.3 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
- 8.4 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
- 8.5 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
- 8.6 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
- 8.7 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
- 8.8 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
- 10.3.x modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
- 10.0.x modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
- 10.2.x modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
Render the area.
Parameters
bool $empty: (optional) Indicator if view result is empty or not. Defaults to FALSE.
Return value
array In any case we need a valid Drupal render array to return.
Overrides AreaPluginBase::render
File
- modules/
social_features/ social_post/ src/ Plugin/ views/ area/ SocialPostPostForm.php, line 105
Class
- SocialPostPostForm
- Provides an area handler which renders a block entity in a certain view mode.
Namespace
Drupal\social_post\Plugin\views\areaCode
public function render($empty = FALSE) {
/** @var \Drupal\block_field\BlockFieldItemInterface $item */
$block_instance = $this
->getBlock();
// Make sure the block exists and is accessible.
if (!$block_instance || !$block_instance
->access(\Drupal::currentUser())) {
return NULL;
}
// @see \Drupal\block\BlockViewBuilder::buildPreRenderableBlock
// @see template_preprocess_block()
$element = [
'#theme' => 'block',
'#attributes' => [],
'#configuration' => $block_instance
->getConfiguration(),
'#plugin_id' => $block_instance
->getPluginId(),
'#base_plugin_id' => $block_instance
->getBaseId(),
'#derivative_plugin_id' => $block_instance
->getDerivativeId(),
'#id' => $block_instance
->getPluginId(),
'content' => $block_instance
->build(),
];
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = \Drupal::service('renderer');
$renderer
->addCacheableDependency($element, $block_instance);
return $element;
}