diff --git a/src/EventSubscriber/RouteParamContext.php b/src/EventSubscriber/RouteParamContext.php
index ea19129..70ef64f 100644
--- a/src/EventSubscriber/RouteParamContext.php
+++ b/src/EventSubscriber/RouteParamContext.php
@@ -63,6 +63,10 @@ class RouteParamContext implements EventSubscriberInterface {
     $routes = $this->routeProvider->getRoutesByPattern($executable->getPage()->getPath())->all();
     $route = reset($routes);
 
+    if (!$route) {
+      return;
+    }
+
     if ($route_contexts = $route->getOption('parameters')) {
       foreach ($route_contexts as $route_context_name => $route_context) {
         // Skip this parameter.
diff --git a/src/PageExecutable.php b/src/PageExecutable.php
index bcf722c..ddaec45 100644
--- a/src/PageExecutable.php
+++ b/src/PageExecutable.php
@@ -8,6 +8,7 @@
 namespace Drupal\page_manager;
 
 use Drupal\Component\Plugin\Context\ContextInterface;
+use Drupal\ctools\ContextManager;
 use Drupal\page_manager\Event\PageManagerContextEvent;
 use Drupal\page_manager\Event\PageManagerEvents;
 use Drupal\page_manager\Plugin\ContextAwareVariantInterface;
@@ -82,7 +83,7 @@ class PageExecutable implements PageExecutableInterface {
    */
   public function getContexts() {
     if (!$this->contexts) {
-      $this->eventDispatcher()->dispatch(PageManagerEvents::PAGE_CONTEXT, new PageManagerContextEvent($this));
+      $this->contexts = $this->contextManager()->getContexts();
     }
     return $this->contexts;
   }
@@ -104,4 +105,12 @@ class PageExecutable implements PageExecutableInterface {
     return \Drupal::service('event_dispatcher');
   }
 
+  /**
+   * Get the context manager.
+   */
+  protected function contextManager() {
+    $plugin = \Drupal::service('plugin.manager.ctools_context_manager')->createInstance('page_manager', ['executable' => $this]);
+    return new ContextManager($plugin);
+  }
+
 }
diff --git a/src/Plugin/ContextManager/PageManagerContextManagerPlugin.php b/src/Plugin/ContextManager/PageManagerContextManagerPlugin.php
new file mode 100644
index 0000000..57f0789
--- /dev/null
+++ b/src/Plugin/ContextManager/PageManagerContextManagerPlugin.php
@@ -0,0 +1,73 @@
+<?php
+
+/**
+ * @file
+ *   Contains \Drupal\page_manager\Plugin\ContextManager\PageManagerContextManagerPlugin
+ */
+
+namespace Drupal\page_manager\Plugin\ContextManager;
+
+use Drupal\Component\Plugin\PluginBase;
+use Drupal\ctools\ContextManagerPluginInterface;
+use Drupal\ctools\ContextManagerPluginRouteContextInterface;
+use Drupal\ctools\ContextManagerPluginStaticContextInterface;
+
+/**
+ * The page manager ctools context manager plugin.
+ *
+ * @ContextManagerPlugin(
+ *   id = "page_manager"
+ * )
+ */
+class PageManagerContextManagerPlugin extends PluginBase implements ContextManagerPluginRouteContextInterface, ContextManagerPluginStaticContextInterface {
+
+  /**
+   * The page executable.
+   *
+   * @var \Drupal\page_manager\PageExecutable
+   */
+  protected $executable;
+
+  /**
+   * {@inheritdoc}
+   */
+  public function __construct(array $configuration, $plugin_id, $plugin_definition) {
+    parent::__construct($configuration, $plugin_id, $plugin_definition);
+
+    $this->executable = $configuration['executable'];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getStaticContexts() {
+    return $this->executable->getPage()->getStaticContexts();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getRoute() {
+    $routes = $this->routeProvider()->getRoutesByPattern($this->executable->getPage()->getPath())->all();
+    return reset($routes);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function includeParameter($name) {
+    // Don't include the page entity parameter in the contexts.
+    if ($name == 'page_manager_page') {
+      return FALSE;
+    }
+
+    return TRUE;
+  }
+
+  /**
+   * Wrapper for the route provider service.
+   */
+  protected function routeProvider() {
+    return \Drupal::get('router.route_provider');
+  }
+}
\ No newline at end of file
