You are here

protected function SocialPostPostForm::getBlock in Open Social 8.7

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::getBlock()
  2. 8 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::getBlock()
  3. 8.2 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::getBlock()
  4. 8.3 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::getBlock()
  5. 8.4 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::getBlock()
  6. 8.5 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::getBlock()
  7. 8.6 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::getBlock()
  8. 8.8 modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::getBlock()
  9. 10.3.x modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::getBlock()
  10. 10.0.x modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::getBlock()
  11. 10.1.x modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::getBlock()
  12. 10.2.x modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php \Drupal\social_post\Plugin\views\area\SocialPostPostForm::getBlock()
1 call to SocialPostPostForm::getBlock()
SocialPostPostForm::render in modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php
Render the area.

File

modules/social_features/social_post/src/Plugin/views/area/SocialPostPostForm.php, line 135

Class

SocialPostPostForm
Provides an area handler which renders a block entity in a certain view mode.

Namespace

Drupal\social_post\Plugin\views\area

Code

protected function getBlock() {
  if (empty($this->options['block_id'])) {
    return NULL;
  }

  /** @var \Drupal\Core\Block\BlockManagerInterface $block_manager */
  $block_manager = \Drupal::service('plugin.manager.block');

  /** @var \Drupal\Core\Block\BlockPluginInterface $block_instance */
  $block_instance = $block_manager
    ->createInstance($this->options['block_id'], []);
  $plugin_definition = $block_instance
    ->getPluginDefinition();

  // Don't return broken block plugin instances.
  if ($plugin_definition['id'] == 'broken') {
    return NULL;
  }

  // Don't return broken block content instances.
  if ($plugin_definition['id'] == 'block_content') {
    $uuid = $block_instance
      ->getDerivativeId();
    if (!\Drupal::entityManager()
      ->loadEntityByUuid('block_content', $uuid)) {
      return NULL;
    }
  }
  return $block_instance;
}