You are here

public function WorkbenchContentController::content in Workbench 8

Page callback for the workbench content page.

Note that we add Views information to the array and render the Views as part of the alter hook provided here.

Return value

array A Render API array of content creation options.

See also

hook_workbench_content_alter()

1 string reference to 'WorkbenchContentController::content'
workbench.routing.yml in ./workbench.routing.yml
workbench.routing.yml

File

src/Controller/WorkbenchContentController.php, line 42

Class

WorkbenchContentController
Generates the pages defined by Workbench.

Namespace

Drupal\workbench\Controller

Code

public function content() {
  $blocks = [];
  $settings = $this
    ->getSettings();

  // This left column is given a width of 35% by workbench.myworkbench.css.
  $blocks['workbench_current_user'] = [
    '#view_id' => $settings['overview_left']['view_id'],
    '#view_display' => $settings['overview_left']['display_id'],
    '#attributes' => [
      'class' => [
        'workbench-left',
      ],
    ],
  ];

  // This right column is given a width of 65% by workbench.myworkbench.css.
  $blocks['workbench_edited'] = [
    '#view_id' => $settings['overview_right']['view_id'],
    '#view_display' => $settings['overview_right']['display_id'],
    '#attributes' => [
      'class' => [
        'workbench-right',
      ],
    ],
  ];
  $blocks['workbench_recent_content'] = [
    '#view_id' => $settings['overview_main']['view_id'],
    '#view_display' => $settings['overview_main']['display_id'],
    '#attributes' => [
      'class' => [
        'workbench-full',
        'workbench-spacer',
      ],
    ],
  ];

  // Allow other modules to alter the default page.
  $context = 'overview';
  \Drupal::moduleHandler()
    ->alter('workbench_content', $blocks, $context);
  return $this
    ->renderBlocks($blocks);
}