class SystemMainBlock

Same name and namespace in other branches
  1. 11.x core/modules/system/src/Plugin/Block/SystemMainBlock.php \Drupal\system\Plugin\Block\SystemMainBlock
  2. 10 core/modules/system/src/Plugin/Block/SystemMainBlock.php \Drupal\system\Plugin\Block\SystemMainBlock
  3. 8.9.x core/modules/system/src/Plugin/Block/SystemMainBlock.php \Drupal\system\Plugin\Block\SystemMainBlock

Provides a 'Main page content' block.

Plugin annotation


@Block(
  id = "system_main_block",
  admin_label = @Translation("Main page content"),
  forms = {
    "settings_tray" = FALSE,
  },
)

Hierarchy

Expanded class hierarchy of SystemMainBlock

File

core/modules/system/src/Plugin/Block/SystemMainBlock.php, line 19

Namespace

Drupal\system\Plugin\Block
View source
class SystemMainBlock extends BlockBase implements MainContentBlockPluginInterface {
  
  /**
   * The render array representing the main page content.
   *
   * @var array
   */
  protected $mainContent;
  
  /**
   * {@inheritdoc}
   */
  public function setMainContent(array $main_content) {
    $this->mainContent = $main_content;
  }
  
  /**
   * {@inheritdoc}
   */
  public function build() {
    return $this->mainContent;
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.