diff --git a/lib/Drupal/views/Plugin/views/display/Attachment.php b/lib/Drupal/views/Plugin/views/display/Attachment.php
index 509d5d8..e2f5a98 100644
--- a/lib/Drupal/views/Plugin/views/display/Attachment.php
+++ b/lib/Drupal/views/Plugin/views/display/Attachment.php
@@ -36,6 +36,16 @@ class Attachment extends DisplayPluginBase {
    */
   protected $usesPager = FALSE;
 
+  /**
+   * The location(s) the contextual links should be rendered to.
+   *
+   * To avoid displaying any contextual links at all, a display plugin can
+   * set this property to an empty array().
+   *
+   * @var Array
+   */
+  protected $contextualLinksLocations = array();
+
   function option_definition() {
     $options = parent::option_definition();
 
diff --git a/lib/Drupal/views/Plugin/views/display/Block.php b/lib/Drupal/views/Plugin/views/display/Block.php
index 1eb9e07..b3255e8 100644
--- a/lib/Drupal/views/Plugin/views/display/Block.php
+++ b/lib/Drupal/views/Plugin/views/display/Block.php
@@ -34,6 +34,16 @@ class Block extends DisplayPluginBase {
    */
   protected $usesAttachments = TRUE;
 
+  /**
+   * The location(s) the contextual links should be rendered to.
+   *
+   * To avoid displaying any contextual links at all, a display plugin can
+   * set this property to an empty array().
+   *
+   * @var Array
+   */
+  protected $contextualLinksLocations = array('block');
+
   function option_definition() {
     $options = parent::option_definition();
 
diff --git a/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
index 63e67cb..cf5ac54 100644
--- a/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
+++ b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
@@ -86,6 +86,16 @@ abstract class DisplayPluginBase extends PluginBase {
    */
   protected $usesAttachments = FALSE;
 
+  /**
+   * The location(s) the contextual links should be rendered to.
+   *
+   * To avoid displaying any contextual links at all, a display plugin can
+   * set this property to an empty array().
+   *
+   * @var Array
+   */
+  protected $contextualLinksLocations = array('view');
+
   function init(&$view, &$display, $options = NULL) {
     $this->view = &$view;
     $this->display = &$display;
@@ -314,6 +324,16 @@ abstract class DisplayPluginBase extends PluginBase {
   }
 
   /**
+   * Defines the location(s) the contextual links should be rendered to.
+   *
+   *
+   * @return Array
+   */
+    function contextualLinksLocations () {
+      return $this->contextualLinksLocations;
+    }
+
+  /**
    * Determines whether this display can use attachments.
    *
    * @return bool
diff --git a/lib/Drupal/views/Plugin/views/display/Page.php b/lib/Drupal/views/Plugin/views/display/Page.php
index 316d93e..3f9773f 100644
--- a/lib/Drupal/views/Plugin/views/display/Page.php
+++ b/lib/Drupal/views/Plugin/views/display/Page.php
@@ -35,6 +35,16 @@ class Page extends DisplayPluginBase {
   protected $usesAttachments = TRUE;
 
   /**
+   * The location(s) the contextual links should be rendered to.
+   *
+   * To avoid displaying any contextual links at all, a display plugin can
+   * set this property to an empty array().
+   *
+   * @var Array
+   */
+  protected $contextualLinksLocations = array('page');
+
+  /**
    * The page display has a path.
    */
   function has_path() { return TRUE; }
diff --git a/views.module b/views.module
index f6d8116..4bc01a8 100644
--- a/views.module
+++ b/views.module
@@ -898,29 +898,18 @@ function views_add_contextual_links(&$render_element, $location, $view, $display
   // Do not do anything if the view is configured to hide its administrative
   // links.
   if (empty($view->hide_admin_links)) {
+    $plugin = $view->display[$display_id]->handler;
+    $contextual_links_locations = $plugin->contextualLinksLocations();
+    $plugin_data = views_fetch_plugin_data('display', $view->display[$display_id]->display_plugin);
+    $contextual_links = isset($plugin_data['contextual links']) ? $plugin_data['contextual links'] : array();
+    // On exposed_forms blocks contextual links should always be visible.
+    $contextual_links_locations[] = 'special_block_-exp';
     // 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., {""}.)
-
-    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();
-    }
-    else {
-      $plugin += array('contextual_links_locations' => array('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) {
+    $has_links = !empty($contextual_links);
+    if ($has_links && in_array($location, $contextual_links_locations)) {
+      foreach ($contextual_links as $module => $link) {
         $args = array();
         $valid = TRUE;
         if (!empty($link['argument properties'])) {
