summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/Render
diff options
context:
space:
mode:
authorGábor Hojtsy2018-05-29 16:11:54 (GMT)
committerGábor Hojtsy2018-05-29 16:12:49 (GMT)
commitf16ee05a6e975e7db74797772f3b50468e57799e (patch)
tree8c7db2a40b34533f131fed5f1ba65ae37359b9ea /core/lib/Drupal/Core/Render
parenta8f46205a0cae7508967ec600b489d93844270d8 (diff)
Issue #2916781 by timmillwood, tedbow, drpal, lauriii, Adita, andrewmacpherson, yoroy, amateescu, borisson_, ckrina: Allow off-canvas dialog to be rendered at the top of the page
Diffstat (limited to 'core/lib/Drupal/Core/Render')
-rw-r--r--core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php b/core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php
index 55bf8eb..b8f0e73 100644
--- a/core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php
+++ b/core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php
@@ -24,16 +24,26 @@ class OffCanvasRenderer extends DialogRenderer {
protected $renderer;
/**
+ * The position to render the off-canvas dialog.
+ *
+ * @var string
+ */
+ protected $position;
+
+ /**
* Constructs a new OffCanvasRenderer.
*
* @param \Drupal\Core\Controller\TitleResolverInterface $title_resolver
* The title resolver.
* @param \Drupal\Core\Render\RendererInterface $renderer
* The renderer.
+ * @param string $position
+ * (optional) The position to render the off-canvas dialog.
*/
- public function __construct(TitleResolverInterface $title_resolver, RendererInterface $renderer) {
+ public function __construct(TitleResolverInterface $title_resolver, RendererInterface $renderer, $position = 'side') {
parent::__construct($title_resolver);
$this->renderer = $renderer;
+ $this->position = $position;
}
/**
@@ -55,7 +65,7 @@ class OffCanvasRenderer extends DialogRenderer {
// Determine the title: use the title provided by the main content if any,
// otherwise get it from the routing information.
$options = $request->request->get('dialogOptions', []);
- $response->addCommand(new OpenOffCanvasDialogCommand($title, $content, $options));
+ $response->addCommand(new OpenOffCanvasDialogCommand($title, $content, $options, NULL, $this->position));
return $response;
}