public function ImageBrowserController::page in Image Entity Browser 8
1 string reference to 'ImageBrowserController::page'
File
- src/
Controller/ ImageBrowserController.php, line 14
Class
Namespace
Drupal\image_browser\ControllerCode
public function page() {
//We only accept ajax request for that page
if (false == \Drupal::request()
->isXmlHttpRequest()) {
throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException();
}
$html_id = Html::getUniqueId('dexp-image-browser');
return [
[
'#theme' => 'links',
'#attributes' => [
'class' => [
'dexp-image-browser-tabs',
],
],
'#links' => [
'upload_link' => [
'title' => $this
->t('Upload'),
'url' => \Drupal\Core\Url::fromRoute('image_browser.upload'),
'ajax' => [
'wrapper' => $html_id,
'method' => 'html',
],
],
'library_browser' => [
'title' => $this
->t('Library'),
'url' => \Drupal\Core\Url::fromRoute('image_browser.library'),
'ajax' => [
'wrapper' => $html_id,
'method' => 'html',
],
],
],
],
[
'#markup' => '<div id="' . $html_id . '"></div>',
],
];
}