You are here

public function SocialPostPostForm::render in Open Social 8.3

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
  2. 8 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
  3. 8.2 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
  4. 8.4 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
  5. 8.5 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
  6. 8.6 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
  7. 8.7 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
  8. 8.8 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
  9. 10.3.x modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
  10. 10.0.x modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
  11. 10.1.x modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::render()
  12. 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\area

Code

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;
}