Commit 9fc19098 authored by EclipseGc's avatar EclipseGc Committed by japerry

Issue #2465193 by EclipseGc: Allow modules to alter IPE buttons w/o hook_page_alter implementation

parent 1432d0c0
......@@ -221,6 +221,7 @@ function panels_ipe_get_cache_key($key = NULL) {
*/
function panels_ipe_toolbar_add_button($cache_key, $id, $button) {
$buttons = &drupal_static('panels_ipe_toolbar_buttons', array());
drupal_alter('panels_ipe_button', $button, $id, $cache_key);
$buttons[$cache_key][$id] = $button;
}
......@@ -246,9 +247,11 @@ function panels_ipe_page_alter(&$page) {
function theme_panels_ipe_toolbar($vars) {
$buttons = $vars['buttons'];
ctools_include('cleanstring');
$output = "<div id='panels-ipe-control-container' class='clearfix'>";
foreach ($buttons as $key => $ipe_buttons) {
$key = ctools_cleanstring($key);
$output .= "<div id='panels-ipe-control-$key' class='panels-ipe-control'>";
// Controls in this container will appear when the IPE is not on.
......
......@@ -42,7 +42,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
'#suffix' => '</div>',
);
panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-startedit', $button);
panels_ipe_toolbar_add_button($this->display->cache_key, 'panels-ipe-startedit', $button);
// @todo this actually should be an IPE setting instead.
if (user_access('change layouts in place editing')) {
......@@ -63,7 +63,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
'#suffix' => '</div>',
);
panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-change-layout', $button);
panels_ipe_toolbar_add_button($this->display->cache_key, 'panels-ipe-change-layout', $button);
}
ctools_include('ajax');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment