"Edit view" link does not work on block displays when view name + display name are longer than 32 chars.
Explanation here: #1123654: Views block deltas being outputted as hashes?

Comments

penyaskito’s picture

diff --git a/sites/all/modules/contrib/contextual/contextual.module b/sites/all/modules/contrib/contextual/contextual.module
index 0fa148e..46576dc 100644
--- a/sites/all/modules/contrib/contextual/contextual.module
+++ b/sites/all/modules/contrib/contextual/contextual.module
@@ -98,19 +98,31 @@ function block_admin_link($type, $object) {
 function views_admin_link($type, $object) {
   $links = array();
   $view_name = '';
+  $display_id = '';
   if (user_access('administer views')) {
+    $hashes = variable_get('views_block_hashes', array());
+
     switch ($type) {
       case 'block':
         // If this is a Views block and not a special (exposed filter, etc.) block...
         if ($object->module == 'views' && strpos($object->delta, '-') !== 0) {
           $split = explode('-', $object->delta);
           $view_name = array_shift($split);
+          $display_id = array_shift($split);
+        }
+        // If the view name and the display name are longer than 32 chars, views saves them
+        // hashed and we need to obtain the real name.
+        if ($object->module == 'views' && isset($hashes[$object->delta])) {
+          $split = explode('-', $hashes[$object->delta]);
+          $view_name = array_shift($split);
+          $display_id = array_shift($split); 
         }
         break;
       case 'views':
         // Bail on block/attachment views or views using the node row plugin to prevent collisions.
         if ($object->display_handler->get_option('row_plugin') != 'node' && !in_array(get_class($object->display_handler), array('views_plugin_display_attachment', 'views_plugin_display_block'))) {
           $view_name = $object->name;
+          $display_id = $object->current_display;
         }
         break;
     }
@@ -121,7 +133,7 @@ function views_admin_link($type, $object) {
         'attributes' => array('class' => 'icon-edit'),
         'query' => array('destination' => $_GET['q']),
       );
-      if ($display_id = $object->display_handler->display->id) {
+      if ($type == 'views' || $object->module == 'views') {
         $links['views-edit']['fragment'] = 'views-tab-'. $display_id;
       }
     }
penyaskito’s picture

penyaskito’s picture

Assigned: Unassigned » penyaskito
Status: Active » Needs work
penyaskito’s picture

Assigned: penyaskito » Unassigned
Issue summary: View changes

Unassigned, I'm not working with D6 anymore.