diff --git a/lib/Drupal/views/Plugin/views/display/Attachment.php b/lib/Drupal/views/Plugin/views/display/Attachment.php
index 7a1fc1a..6e2b947 100644
--- a/lib/Drupal/views/Plugin/views/display/Attachment.php
+++ b/lib/Drupal/views/Plugin/views/display/Attachment.php
@@ -23,8 +23,7 @@ use Drupal\Core\Annotation\Translation;
  *   id = "attachment",
  *   title = @Translation("Attachment"),
  *   help = @Translation("Attachments added to other displays to achieve multiple views in the same view."),
- *   theme = "views_view",
- *   contextual_links_locations = {""}
+ *   theme = "views_view"
  * )
  */
 class Attachment extends DisplayPluginBase {
@@ -36,6 +35,14 @@ class Attachment extends DisplayPluginBase {
    */
   protected $usesPager = FALSE;
 
+  /**
+   * Whether the displays alows to show contextual links.
+   *
+   * @var bool
+   */
+  protected $usesContextualLinks = FALSE;
+
+
   protected function defineOptions() {
     $options = parent::defineOptions();
 
diff --git a/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
index b8ab779..7d10b3e 100644
--- a/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
+++ b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
@@ -86,6 +86,21 @@ abstract class DisplayPluginBase extends PluginBase {
    */
   protected $usesAttachments = FALSE;
 
+  /**
+   * Whether the displays alows to show contextual links.
+   *
+   * @var bool
+   */
+  protected $usesContextualLinks = TRUE;
+
+  /**
+   * The location(s) the contextual links should be rendered to.
+   *
+   * @var Array
+   */
+  protected $contextualLinksLocations = array('view');
+
+
   public function init(&$view, &$display, $options = NULL) {
     $this->view = &$view;
     $this->display = &$display;
@@ -175,6 +190,24 @@ abstract class DisplayPluginBase extends PluginBase {
   }
 
   /**
+   * Defines the location(s) the contextual links should be rendered to.
+   *
+   * @return Array
+   */
+  function contextualLinksLocations() {
+    return $this->contextualLinksLocations;
+  }
+
+  /**
+   * Whether the display allows the use of contextual links or not.
+   *
+   * @return bool
+   */
+  public function usesContextualLinks() {
+    return $this->usesAJAX;
+  }
+
+  /**
    * Determine if this display is the 'default' display which contains
    * fallback settings
    */
@@ -1174,7 +1207,7 @@ abstract class DisplayPluginBase extends PluginBase {
         'desc' => t('Change whether or not to display attachments when displaying a contextual filter summary.'),
       );
     }
-    if (!isset($this->definition['contextual links locations']) || !empty($this->definition['contextual links locations'])) {
+    if ($this->$usesContextualLinks) {
       $options['hide_admin_links'] = array(
         'category' => 'other',
         'title' => t('Hide contextual links'),
diff --git a/lib/Drupal/views/Plugin/views/display/Page.php b/lib/Drupal/views/Plugin/views/display/Page.php
index 4a0285b..46d3abb 100644
--- a/lib/Drupal/views/Plugin/views/display/Page.php
+++ b/lib/Drupal/views/Plugin/views/display/Page.php
@@ -22,7 +22,6 @@ use Drupal\Core\Annotation\Translation;
  *   title = @Translation("Page"),
  *   help = @Translation("Display the view as a page, with a URL and menu links."),
  *   uses_hook_menu = TRUE,
- *   contextual_links_locations = {"page"},
  *   theme = "views_view",
  *   admin = @Translation("Page")
  * )
@@ -37,6 +36,13 @@ class Page extends DisplayPluginBase {
   protected $usesAttachments = TRUE;
 
   /**
+   * The location(s) the contextual links should be rendered to.
+   *
+   * @var Array
+   */
+  protected $contextualLinksLocations = array('page');
+
+  /**
    * The page display has a path.
    */
   public function hasPath() { return TRUE; }
diff --git a/views.module b/views.module
index 65d882c..8c4d580 100644
--- a/views.module
+++ b/views.module
@@ -910,26 +910,35 @@ function views_add_contextual_links(&$render_element, $location, $view, $display
     // Also do not do anything if the display plugin has not defined any
     // contextual links that are intended to be displayed in the requested
     // location.
-    $plugin = views_fetch_plugin_data('display', $view->display[$display_id]->display_plugin);
-    // If contextual_links_locations are not set, provide a sane default. (To
-    // avoid displaying any contextual links at all, a display plugin can still
-    // set 'contextual_links_locations' to, e.g., {""}.)
+    $plugin = $view->display[$display_id]->handler;
 
-    if (!isset($plugin['contextual_links_locations'])) {
-      $plugin['contextual_links_locations'] = array('view');
-    }
-    elseif ($plugin['contextual_links_locations'] = array() || $plugin['contextual_links_locations'] == array('')) {
-      $plugin['contextual_links_locations'] = array();
+    // Only continue if we should add contextual links
+    if (!$plugin->usesContextualLinks())
+      return;
+
+    $plugin_data = views_fetch_plugin_data('display', $view->display[$display_id]->display_plugin);
+
+    // Only continue if there are modules providing contextual links
+    if (!isset($plugin_data['contextual links']))
+      return;
+
+    $contextual_links_locations = $plugin->contextualLinksLocations();
+
+    // If contextual_links_locations are not set, provide a sane default.
+    if (!isset($contextual_links_locations)) {
+      $contextual_links_locations = array('view');
     }
     else {
-      $plugin += array('contextual_links_locations' => array('view'));
+      $contextual_links_locations[] = 'view';
     }
-
     // On exposed_forms blocks contextual links should always be visible.
-    $plugin['contextual_links_locations'][] = 'special_block_-exp';
-    $has_links = !empty($plugin['contextual links']) && !empty($plugin['contextual_links_locations']);
-    if ($has_links && in_array($location, $plugin['contextual_links_locations'])) {
-      foreach ($plugin['contextual links'] as $module => $link) {
+    $contextual_links_locations[] = 'special_block_-exp';
+
+    // Filter duplicates if they exist
+    $contextual_links_locations = array_unique($contextual_links_locations);
+
+    if (in_array($location, $contextual_links_locations)) {
+      foreach ($plugin_data['contextual links'] as $module => $link) {
         $args = array();
         $valid = TRUE;
         if (!empty($link['argument properties'])) {
