Index: plugins/display_renderers/panels_renderer_editor.class.php
=========================================================
--- plugins/display_renderers/panels_renderer_editor.class.php	(revision 1.5)
+++ plugins/display_renderers/panels_renderer_editor.class.php	Fri Nov 05 19:23:16 EDT 2010
@@ -169,12 +169,12 @@
 
     $style_title = isset($style['title']) ? $style['title'] : t('Default');
 
-    $style_links[] = array(
+    $style_links[$type . '-style-title'] = array(
       'title' => $style_title,
       'attributes' => array('class' => array('panels-text')),
     );
 
-    $style_links[] = array(
+    $style_links[$type . '-style-change'] = array(
       'title' => t('Change'),
       'href' => $this->get_url('style-type', $type, $id),
       'attributes' => array('class' => array('ctools-use-modal')),
@@ -182,13 +182,16 @@
 
     $function = $type != 'pane' ? 'settings form' : 'pane settings form';
     if (panels_plugin_get_function('styles', $style, $function)) {
-      $style_links[] = array(
+      $style_links[$type . '-style-settings'] = array(
         'title' => t('Settings'),
         'href' => $this->get_url('style-settings', $type, $id),
         'attributes' => array('class' => array('ctools-use-modal')),
       );
     }
 
+    $context = array('panels_renderer_editor' => $this, 'type' => $type, 'id' => $id);
+    drupal_alter('panels_links_style', $style_links, $context);
+
     return $style_links;
   }
 
@@ -200,14 +203,14 @@
   function get_display_links() {
     $links = array();
     $style_links = $this->get_style_links('display');
-    $links[] = array(
+    $links['display-style'] = array(
       'title' => '<span class="dropdown-header">' . t('Style') . '</span>' . theme_links(array('links' => $style_links, 'attributes' => array(), 'heading' => array())),
       'html' => TRUE,
       'attributes' => array('class' => array('panels-sub-menu')),
     );
 
     if (user_access('use panels caching features')) {
-      $links[] = array(
+      $links['display-divider-1'] = array(
         'title' => '<hr />',
         'html' => TRUE,
       );
@@ -216,30 +219,33 @@
       $info = panels_get_cache($method);
       $cache_method = isset($info['title']) ? $info['title'] : t('No caching');
 
-      $cache_links[] = array(
+      $cache_links['display-cache-method'] = array(
         'title' => $cache_method,
         'attributes' => array('class' => array('panels-text')),
       );
-      $cache_links[] = array(
+      $cache_links['display-cache-change'] = array(
         'title' => t('Change'),
         'href' => $this->get_url('cache-method', 'display'),
         'attributes' => array('class' => array('ctools-use-modal')),
       );
       if (panels_plugin_get_function('cache', $info, 'settings form')) {
-        $cache_links[] = array(
+        $cache_links['display-cache-settings'] = array(
           'title' => t('Settings'),
           'href' => $this->get_url('cache-settings', 'display'),
           'attributes' => array('class' => array('ctools-use-modal')),
         );
       }
 
-      $links[] = array(
+      $links['display-cache'] = array(
         'title' => '<span class="dropdown-header">' . t('Caching') . '</span>' . theme_links(array('links' => $cache_links, 'attributes' => array(), 'heading' => array())),
         'html' => TRUE,
         'attributes' => array('class' => array('panels-sub-menu')),
       );
     }
 
+    $context = array('panels_renderer_editor' => $this);
+    drupal_alter('panels_links_display', $links, $context);
+    
     return theme('ctools_dropdown', array('title' => t('Display settings'), 'link' => $links, 'class' => 'panels-display-links'));
   }
 
@@ -248,7 +254,7 @@
    */
   function get_region_links($region_id) {
     $links = array();
-    $links[] = array(
+    $links['region-add-content'] = array(
       'title' => t('Add content'),
       'href' => $this->get_url('select-content', $region_id),
       'attributes' => array(
@@ -256,19 +262,22 @@
       ),
     );
 
-    $links[] = array(
+    $links['region-divider-1'] = array(
       'title' => '<hr />',
       'html' => TRUE,
     );
 
     $style_links = $this->get_style_links('region', $region_id);
 
-    $links[] = array(
+    $links['region-style'] = array(
       'title' => '<span class="dropdown-header">' . t('Style') . '</span>' . theme_links(array('links' => $style_links, 'attributes' => array(), 'heading' => array())),
       'html' => TRUE,
       'attributes' => array('class' => array('panels-sub-menu')),
     );
 
+    $context = array('panels_renderer_editor' => $this, 'region_id' => $region_id);
+    drupal_alter('panels_links_region', $links, $context);
+
     return theme('ctools_dropdown', array('title' => theme('image', array('path' => ctools_image_path('icon-addcontent.png', 'panels'))), 'links' => $links, 'image' => TRUE, 'class' => 'pane-add-link panels-region-links-' . $region_id));
   }
 
@@ -279,14 +288,14 @@
     $links = array();
 
     if (!empty($pane->shown)) {
-      $links[] = array(
+      $links['pane-disable'] = array(
         'title' => t('Disable this pane'),
         'href' => $this->get_url('hide', $pane->pid),
         'attributes' => array('class' => array('use-ajax')),
       );
     }
     else {
-      $links[] = array(
+      $links['pane-enable'] = array(
         'title' => t('Enable this pane'),
         'href' => $this->get_url('show', $pane->pid),
         'attributes' => array('class' => array('use-ajax')),
@@ -310,7 +319,7 @@
     $subtype = ctools_content_get_subtype($content_type, $pane->subtype);
 
     if (ctools_content_editable($content_type, $subtype, $pane->configuration)) {
-      $links[] = array(
+      $links['pane-settings'] = array(
         'title' => isset($content_type['edit text']) ? $content_type['edit text'] : t('Settings'),
         'href' => $this->get_url('edit-pane', $pane->pid),
         'attributes' => array('class' => array('ctools-use-modal')),
@@ -318,28 +327,28 @@
     }
 
     if (user_access('administer advanced pane settings')) {
-      $links[] = array(
+      $links['pane-css'] = array(
         'title' => t('CSS properties'),
         'href' => $this->get_url('pane-css', $pane->pid),
         'attributes' => array('class' => array('ctools-use-modal')),
       );
     }
 
-    $links[] = array(
+    $links['pane-divider-1'] = array(
       'title' => '<hr />',
       'html' => TRUE,
     );
 
     $style_links = $this->get_style_links('pane', $pane->pid);
 
-    $links[] = array(
+    $links['pane-style'] = array(
       'title' => '<span class="dropdown-header">' . t('Style') . '</span>' . theme_links(array('links' => $style_links, 'attributes' => array(), 'heading' => array())),
       'html' => TRUE,
       'attributes' => array('class' => array('panels-sub-menu')),
     );
 
     if (user_access('administer pane access')) {
-      $links[] = array(
+      $links['pane-divider-2'] = array(
         'title' => '<hr />',
         'html' => TRUE,
       );
@@ -358,7 +367,7 @@
           $access_title  = isset($plugin['title']) ? $plugin['title'] : t('Broken/missing access plugin %plugin', array('%plugin' => $test['name']));
           $access_description = ctools_access_summary($plugin, $contexts, $test);
 
-          $visibility_links[] = array(
+          $visibility_links['pane-visibility-' . $id] = array(
             'title' => $access_description,
             'href' => $this->get_url('access-configure-test', $pane->pid, $id),
             'attributes' => array('class' => array('ctools-use-modal', 'panels-italic')),
@@ -366,25 +375,25 @@
         }
       }
       if (empty($visibility_links)) {
-        $visibility_links[] = array(
+        $visibility_links['pane-visibility-none'] = array(
           'title' => t('No rules'),
           'attributes' => array('class' => array('panels-text')),
         );
       }
 
-      $visibility_links[] = array(
+      $visibility_links['pane-visibility-add-rule'] = array(
         'title' => t('Add new rule'),
         'href' => $this->get_url('access-add-test', $pane->pid),
         'attributes' => array('class' => array('ctools-use-modal')),
       );
 
-      $visibility_links[] = array(
+      $visibility_links['pane-visibility-settings'] = array(
         'title' => t('Settings'),
         'href' => $this->get_url('access-settings', $pane->pid),
         'attributes' => array('class' => array('ctools-use-modal')),
       );
 
-      $links[] = array(
+      $links['pane-visibility'] = array(
         'title' => '<span class="dropdown-header">' . t('Visibility rules') . '</span>' . theme_links(array('links' => $visibility_links, 'attributes' => array(), 'heading' => array())),
         'html' => TRUE,
         'attributes' => array('class' => array('panels-sub-menu')),
@@ -392,7 +401,7 @@
     }
 
     if (panels_get_caches() && user_access('use panels caching features')) {
-      $links[] = array(
+      $links['pane-divider-3'] = array(
         'title' => '<hr />',
         'html' => TRUE,
       );
@@ -400,36 +409,36 @@
       $method = isset($pane->cache['method']) ? $pane->cache['method'] : 0;
       $info = panels_get_cache($method);
       $cache_method = isset($info['title']) ? $info['title'] : t('No caching');
-      $cache_links[] = array(
+      $cache_links['pane-cache-method'] = array(
         'title' => $cache_method,
         'attributes' => array('class' => array('panels-text')),
       );
-      $cache_links[] = array(
+      $cache_links['pane-cache-change'] = array(
         'title' => t('Change'),
         'href' => $this->get_url('cache-method', $pane->pid),
         'attributes' => array('class' => array('ctools-use-modal')),
       );
       if (panels_plugin_get_function('cache', $info, 'settings form')) {
-        $cache_links[] = array(
+        $cache_links['pane-cache-settings'] = array(
           'title' => t('Settings'),
           'href' => $this->get_url('cache-settings', $pane->pid),
           'attributes' => array('class' => array('ctools-use-modal')),
         );
       }
 
-      $links[] = array(
+      $links['pane-cache'] = array(
         'title' => '<span class="dropdown-header">' . t('Caching') . '</span>' . theme_links(array('links' => $cache_links, 'attributes' => array(), 'heading' => array())),
         'html' => TRUE,
         'attributes' => array('class' => array('panels-sub-menu')),
       );
     }
 
-    $links[] = array(
+    $links['pane-divider-4'] = array(
       'title' => '<hr />',
       'html' => TRUE,
     );
 
-    $links[] = array(
+    $links['pane-remove'] = array(
       'title' => t('Remove'),
       'href' => '#',
       'attributes' => array(
@@ -438,6 +447,9 @@
       ),
     );
 
+    $context = array('panels_renderer_editor' => $this, 'pane' => $pane, 'content_type' => $content_type);
+    drupal_alter('panels_links_pane', $links, $context);
+
     return theme('ctools_dropdown', array('title' => theme('image', array('path' => ctools_image_path('icon-configure.png', 'panels'))), 'links' => $links, 'image' => TRUE));
   }
 
