Projet

Général

Profil

Révision 136a805a

Ajouté par Assos Assos il y a plus de 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/panels/plugins/task_handlers/panel_context.inc
286 286

  
287 287
  $display->context = $contexts;
288 288
  $display->args = $args;
289
  $display->css_id = $handler->conf['css_id'];
289
  $page_css_id = ctools_context_keyword_substitute($handler->conf['css_id'], array(), $contexts);
290
  $display->css_id = drupal_html_id($page_css_id);
290 291
  $task_name = page_manager_make_task_name($handler->task, $handler->subtask);
291 292

  
292 293
  $display->cache_key = panels_panel_context_cache_key($task_name, $handler->name, $args);
......
297 298
    $css_id = 'panel_context:' . $handler->name;
298 299
    $filename = ctools_css_retrieve($css_id);
299 300
    if (!$filename) {
300
      $filename = ctools_css_store($css_id, $handler->conf['css']);
301
      // Add keywords from context
302
      $css = ctools_context_keyword_substitute($handler->conf['css'], array(), $contexts, array('css safe' => TRUE));
303
      $filename = ctools_css_store($css_id, $css);
301 304
    }
302 305
    drupal_add_css($filename);
303 306
  }
......
318 321
  $panel_body_css = &drupal_static('panel_body_css');
319 322

  
320 323
  if (isset($handler->conf['body_classes_to_remove'])) {
324
    $classes = ctools_context_keyword_substitute($handler->conf['body_classes_to_remove'], array(), $contexts, array('css safe' => TRUE));
321 325
    if (!isset($panel_body_css['body_classes_to_remove'])) {
322
      $panel_body_css['body_classes_to_remove'] = $handler->conf['body_classes_to_remove'];
326
      $panel_body_css['body_classes_to_remove'] = check_plain(drupal_strtolower($classes));
323 327
    }
324 328
    else{
325
      $panel_body_css['body_classes_to_remove'] .= ' ' . $handler->conf['body_classes_to_remove'];
329
      $panel_body_css['body_classes_to_remove'] .= ' ' . check_plain(drupal_strtolower($classes));
326 330
    }
327 331
  }
328 332
  if (isset($handler->conf['body_classes_to_add'])) {
333
    $classes = ctools_context_keyword_substitute($handler->conf['body_classes_to_add'], array(), $contexts, array('css safe' => TRUE));
329 334
    if (!isset($panel_body_css['body_classes_to_add'])) {
330
      $panel_body_css['body_classes_to_add'] = $handler->conf['body_classes_to_add'];
335
    $panel_body_css['body_classes_to_add'] = check_plain(drupal_strtolower($classes));
331 336
    }
332 337
    else {
333
      $panel_body_css['body_classes_to_add'] .= ' '. $handler->conf['body_classes_to_add'];
338
      $panel_body_css['body_classes_to_add'] .= ' '. check_plain(drupal_strtolower($classes));
334 339
    }
335 340
  }
336 341

  
......
581 586

  
582 587
  $form_state['display'] = &panels_panel_context_get_display($form_state['handler']);
583 588

  
589
  // Grab the storage_type and storage_id and inject it into the display.
590
  if (empty($form_state['display']->storage_type)) {
591
    if (!isset($form_state[$form_state['task_id']]->storage_type)) {
592
      watchdog('panels', "Unable to find the storage type for specified storage. Read 'Upgrading task handlers' in CHANGELOG.txt", array(), WATCHDOG_ERROR);
593
      $form_state['display']->storage_type = 'unknown';
594
    }
595
    else {
596
      $form_state['display']->storage_type = $form_state[$form_state['task_id']]->storage_type;
597
    }
598
    // When adding variants, we don't know the handler id yet. In that case,
599
    // Mark it as new. We'll assign it later.
600
    $form_state['display']->storage_id = !empty($form_state['handler_id']) ? $form_state['handler_id'] : 'new';
601
  }
584 602
  // Tell the Panels form not to display buttons.
585 603
  $form_state['no buttons'] = TRUE;
586 604

  
......
738 756
}
739 757

  
740 758
function panels_panel_context_edit_content_submit(&$form, &$form_state) {
759
  // Update the storage_id if this is a new variant before saving.
760
  if ($form_state['display']->storage_id == 'new') {
761
    $form_state['display']->storage_id = $form_state['handler_id'];
762
  }
741 763
  panels_edit_display_form_submit($form, $form_state);
742 764
  $handler = &$form_state['handler'];
743 765

  
......
775 797
    '#size' => 128,
776 798
    '#default_value' => empty($conf['body_classes_to_remove']) ? '' : $conf['body_classes_to_remove'],
777 799
    '#title' => t('Remove body CSS classes'),
778
    '#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.'),
800
    '#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.'),
779 801
  );
780 802

  
781 803
  $form['conf']['body_classes_to_add'] = array(
......
783 805
    '#size' => 128,
784 806
    '#default_value' => empty($conf['body_classes_to_add']) ? '' : $conf['body_classes_to_add'],
785 807
    '#title' => t('Add body CSS classes'),
786
    '#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.'),
808
    '#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.'),
787 809
  );
788 810

  
789 811
  ctools_include('plugins', 'panels');
......
823 845
    '#size' => 35,
824 846
    '#default_value' => $conf['css_id'],
825 847
    '#title' => t('CSS ID'),
826
    '#description' => t('The CSS ID to apply to this page'),
848
    '#description' => t('The CSS ID to apply to this page. Keywords from context are allowed.'),
827 849
  );
828 850

  
829 851
  $form['conf']['css'] = array(
830 852
    '#type' => 'textarea',
831 853
    '#title' => t('CSS code'),
832
    '#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.'),
854
    '#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.'),
833 855
    '#default_value' => $conf['css'],
834 856
  );
835 857

  

Formats disponibles : Unified diff