You are here

public function FileManagementController::viewFilePage in File Management 8

Provides the file view page.

Parameters

\Drupal\file\FileInterface $file: The file entity to edit.

Return value

array The file edit form.

1 string reference to 'FileManagementController::viewFilePage'
file_management.routing.yml in ./file_management.routing.yml
file_management.routing.yml

File

src/Controller/FileManagementController.php, line 22

Class

FileManagementController
Provides the view, add pages and title callbacks for file entities.

Namespace

Drupal\file_management\Controller

Code

public function viewFilePage(FileInterface $file = NULL) {
  if (empty($file)) {

    // drupal_set_message
    // return to previous page or file overview page (use route)
  }
  $file_information = \Drupal::service('file_management')
    ->getFileInformation($file);
  if (!empty(\Drupal::request()->query
    ->get('destination'))) {
    $file_information['actions']['#type'] = 'actions';
    \Drupal::service('file_management')
      ->addBackButton($file_information['actions'], $this
      ->t('Back'));
  }
  return $file_information;
}