theme.inc 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Preprocessor for theme('context_ui_editor').
  4. */
  5. function template_preprocess_context_ui_editor(&$vars) {
  6. drupal_add_css(drupal_get_path('module', 'context_ui') . '/context_ui.css');
  7. drupal_add_js(drupal_get_path('module', 'context_ui') . '/context_ui.js');
  8. drupal_add_js(drupal_get_path('module', 'context_ui') . '/jquery.pageEditor.js');
  9. $vars['contexts'] = $vars['form']['contexts'];
  10. unset($vars['form']['contexts']);
  11. $vars['buttons'] = $vars['form']['buttons'];
  12. unset($vars['form']['buttons']);
  13. }
  14. /**
  15. * Preprocessor for theme('context_ui_plugins').
  16. */
  17. function template_preprocess_context_ui_plugins(&$vars) {
  18. drupal_add_css(drupal_get_path("module", "context_ui") . "/context_ui.css");
  19. drupal_add_js(drupal_get_path("module", "context_ui") . "/context_ui.js");
  20. drupal_add_js(drupal_get_path('module', 'context_ui') . '/jquery.pageEditor.js');
  21. // Provide title & desc.
  22. $vars['title'] = check_plain($vars['form']['#title']);
  23. $vars['description'] = check_plain($vars['form']['#description']);
  24. // Build list of plugins.
  25. $plugins = array();
  26. $vars['plugins'] = array();
  27. foreach (element_children($vars['form']['plugins']) as $plugin) {
  28. $link = array(
  29. 'title' => $vars['form']['plugins'][$plugin]['#plugin']->title . "<span class='remove'>" . t('Remove') . "</span>",
  30. 'href' => $_GET['q'],
  31. 'html' => TRUE,
  32. 'fragment' => "context-plugin-form-{$plugin}",
  33. );
  34. $class = $vars['form']['plugins'][$plugin]['#context_enabled'] ? "context-plugin-{$plugin}" : "context-plugin-{$plugin} disabled";
  35. $vars['plugins'][$class] = $link;
  36. }
  37. }
  38. /**
  39. * Preprocessor for theme('context_ui_form').
  40. */
  41. function template_preprocess_context_ui_form(&$vars) {
  42. drupal_add_css(drupal_get_path("module", "context_ui") . "/context_ui.css");
  43. drupal_add_js(drupal_get_path("module", "context_ui") . "/context_ui.js");
  44. drupal_add_js(drupal_get_path('module', 'context_ui') . '/jquery.pageEditor.js');
  45. $vars['buttons'] = $vars['form']['buttons'];
  46. unset($vars['form']['buttons']);
  47. }