diff --git a/plugins/display_renderers/panels_renderer_editor.class.php b/plugins/display_renderers/panels_renderer_editor.class.php index 040c3db2287d4b1569b46bac8993c9d739e86b3b..409a4088b1d735c8b322c31a9c22978a88881146 100644 --- a/plugins/display_renderers/panels_renderer_editor.class.php +++ b/plugins/display_renderers/panels_renderer_editor.class.php @@ -1779,13 +1779,13 @@ function panels_edit_configure_pane_css_form($form, &$form_state) { '#type' => 'textfield', '#default_value' => isset($pane->css['css_id']) ? $pane->css['css_id'] : '', '#title' => t('CSS ID'), - '#description' => t('CSS ID to apply to this pane. This may be blank.'), + '#description' => t('CSS ID to apply to this pane. This may be blank. Keywords from context are allowed.'), ); $form['css_class'] = array( '#type' => 'textfield', '#default_value' => isset($pane->css['css_class']) ? $pane->css['css_class'] : '', '#title' => t('CSS class'), - '#description' => t('CSS class to apply to this pane. This may be blank.'), + '#description' => t('CSS class to apply to this pane. This may be blank. Keywords from context are allowed.'), ); $form['next'] = array( diff --git a/plugins/display_renderers/panels_renderer_standard.class.php b/plugins/display_renderers/panels_renderer_standard.class.php index ab55af146f84a003cb94858fc218a39324a9d8c1..021177ed98c27b926e43241e013c928065b50f81 100644 --- a/plugins/display_renderers/panels_renderer_standard.class.php +++ b/plugins/display_renderers/panels_renderer_standard.class.php @@ -582,12 +582,14 @@ class panels_renderer_standard { if (!empty($content)) { // Pass long the css_id that is usually available. if (!empty($pane->css['css_id'])) { - $content->css_id = check_plain($pane->css['css_id']); + $id = ctools_context_keyword_substitute($pane->css['css_id'], array(), $this->display->context); + $content->css_id = drupal_html_id($id); } // Pass long the css_class that is usually available. if (!empty($pane->css['css_class'])) { - $content->css_class = check_plain($pane->css['css_class']); + $class = ctools_context_keyword_substitute($pane->css['css_class'], array(), $this->display->context, array('css safe' => TRUE)); + $content->css_class = check_plain(drupal_strtolower($class)); } } diff --git a/plugins/task_handlers/panel_context.inc b/plugins/task_handlers/panel_context.inc index 9f03b5549e07723e4a5809a01efd8c5c35009f23..2c65518d2f38601ff4a6f5556e673d77a4c80b07 100644 --- a/plugins/task_handlers/panel_context.inc +++ b/plugins/task_handlers/panel_context.inc @@ -286,7 +286,8 @@ function panels_panel_context_render($handler, $base_contexts, $args, $test = TR $display->context = $contexts; $display->args = $args; - $display->css_id = $handler->conf['css_id']; + $page_css_id = ctools_context_keyword_substitute($handler->conf['css_id'], array(), $contexts); + $display->css_id = drupal_html_id($page_css_id); $task_name = page_manager_make_task_name($handler->task, $handler->subtask); $display->cache_key = panels_panel_context_cache_key($task_name, $handler->name, $args); @@ -297,7 +298,9 @@ function panels_panel_context_render($handler, $base_contexts, $args, $test = TR $css_id = 'panel_context:' . $handler->name; $filename = ctools_css_retrieve($css_id); if (!$filename) { - $filename = ctools_css_store($css_id, $handler->conf['css']); + // Add keywords from context + $css = ctools_context_keyword_substitute($handler->conf['css'], array(), $contexts, array('css safe' => TRUE)); + $filename = ctools_css_store($css_id, $css); } drupal_add_css($filename); } @@ -318,19 +321,21 @@ function panels_panel_context_render($handler, $base_contexts, $args, $test = TR $panel_body_css = &drupal_static('panel_body_css'); if (isset($handler->conf['body_classes_to_remove'])) { + $classes = ctools_context_keyword_substitute($handler->conf['body_classes_to_remove'], array(), $contexts, array('css safe' => TRUE)); if (!isset($panel_body_css['body_classes_to_remove'])) { - $panel_body_css['body_classes_to_remove'] = $handler->conf['body_classes_to_remove']; + $panel_body_css['body_classes_to_remove'] = check_plain(drupal_strtolower($classes)); } else{ - $panel_body_css['body_classes_to_remove'] .= ' ' . $handler->conf['body_classes_to_remove']; + $panel_body_css['body_classes_to_remove'] .= ' ' . check_plain(drupal_strtolower($classes)); } } if (isset($handler->conf['body_classes_to_add'])) { + $classes = ctools_context_keyword_substitute($handler->conf['body_classes_to_add'], array(), $contexts, array('css safe' => TRUE)); if (!isset($panel_body_css['body_classes_to_add'])) { - $panel_body_css['body_classes_to_add'] = $handler->conf['body_classes_to_add']; + $panel_body_css['body_classes_to_add'] = check_plain(drupal_strtolower($classes)); } else { - $panel_body_css['body_classes_to_add'] .= ' '. $handler->conf['body_classes_to_add']; + $panel_body_css['body_classes_to_add'] .= ' '. check_plain(drupal_strtolower($classes)); } } @@ -775,7 +780,7 @@ function panels_panel_context_edit_settings($form, &$form_state) { '#size' => 128, '#default_value' => empty($conf['body_classes_to_remove']) ? '' : $conf['body_classes_to_remove'], '#title' => t('Remove body CSS classes'), - '#description' => t('The CSS classes to remove from the body element of this page. Separated by a space. For example: no-sidebars one-sidebar sidebar-first sidebar-second two-sidebars.'), + '#description' => t('The CSS classes to remove from the body element of this page. Separated by a space. For example: no-sidebars one-sidebar sidebar-first sidebar-second two-sidebars. Keywords from context are allowed.'), ); $form['conf']['body_classes_to_add'] = array( @@ -783,7 +788,7 @@ function panels_panel_context_edit_settings($form, &$form_state) { '#size' => 128, '#default_value' => empty($conf['body_classes_to_add']) ? '' : $conf['body_classes_to_add'], '#title' => t('Add body CSS classes'), - '#description' => t('The CSS classes to add to the body element of this page. Separated by a space. For example: no-sidebars one-sidebar sidebar-first sidebar-second two-sidebars.'), + '#description' => t('The CSS classes to add to the body element of this page. Separated by a space. For example: no-sidebars one-sidebar sidebar-first sidebar-second two-sidebars. Keywords from context are allowed.'), ); ctools_include('plugins', 'panels'); @@ -823,13 +828,13 @@ function panels_panel_context_edit_settings($form, &$form_state) { '#size' => 35, '#default_value' => $conf['css_id'], '#title' => t('CSS ID'), - '#description' => t('The CSS ID to apply to this page'), + '#description' => t('The CSS ID to apply to this page. Keywords from context are allowed.'), ); $form['conf']['css'] = array( '#type' => 'textarea', '#title' => t('CSS code'), - '#description' => t('Enter well-formed CSS code here; this code will be embedded into the page, and should only be used for minor adjustments; it is usually better to try to put CSS for the page into the theme if possible. This CSS will be filtered for safety so some CSS may not work.'), + '#description' => t('Enter well-formed CSS code here; this code will be embedded into the page, and should only be used for minor adjustments; it is usually better to try to put CSS for the page into the theme if possible. This CSS will be filtered for safety so some CSS may not work. Keywords from context are allowed.'), '#default_value' => $conf['css'], );