context_reaction_block.theme.inc

  1. cis7 sites/all/modules/ulmus/context/theme/context_reaction_block.theme.inc
  2. cle7 sites/all/modules/ulmus/context/theme/context_reaction_block.theme.inc
  3. ecd7 sites/all/modules/ulmus/context/theme/context_reaction_block.theme.inc
  4. elmsmedia7 sites/all/modules/ulmus/context/theme/context_reaction_block.theme.inc
  5. harmony7 sites/all/modules/ulmus/context/theme/context_reaction_block.theme.inc
  6. icor7 sites/all/modules/ulmus/context/theme/context_reaction_block.theme.inc
  7. meedjum_blog7 sites/all/modules/ulmus/context/theme/context_reaction_block.theme.inc
  8. mooc7 sites/all/modules/ulmus/context/theme/context_reaction_block.theme.inc

Functions

Namesort descending Description
template_preprocess_context_block_browser Preprocessor for theme('context_block_browser').
template_preprocess_context_block_browser_item Preprocessor for theme('context_block_browser_item').
theme_context_block_edit_wrap Theme wrapper for editable blocks.
theme_context_block_form Block form.
theme_context_block_regions_form Generates the AJAX enabled block administration portion of the context_ui admin form.
theme_context_block_script_placeholder Use placeholder content for script tags that need to be replaced.

File

sites/all/modules/ulmus/context/theme/context_reaction_block.theme.inc
View source
  1. <?php
  2. /**
  3. * Block form.
  4. */
  5. function theme_context_block_form($vars) {
  6. $row = array(
  7. array('data' => drupal_render($vars['form']['blocks']), 'class' => array('blocks')),
  8. array('data' => drupal_render($vars['form']['selector']) . drupal_render($vars['form']['block']['help']), 'class' => array('selector')),
  9. );
  10. $output = drupal_render_children($vars['form']);
  11. $table = array(
  12. 'rows' => array($row),
  13. 'attributes' => array('id' => 'context-blockform'),
  14. );
  15. $output .= theme('table', $table);
  16. return $output;
  17. }
  18. /**
  19. * Generates the AJAX enabled block administration portion of the context_ui admin form.
  20. */
  21. function theme_context_block_regions_form($vars) {
  22. $form = $vars['form'];
  23. // Add draggable weights
  24. drupal_add_js('misc/tableheader.js');
  25. drupal_add_js(drupal_get_path('module', 'context') . '/plugins/context_reaction_block.js');
  26. drupal_add_css(drupal_get_path('module', 'context') . '/plugins/context_reaction_block.css');
  27. $output = '';
  28. foreach (element_children($form) as $region) {
  29. $attr = array(
  30. 'id' => "context-blockform-region-{$region}",
  31. 'class' => array("context-blockform-region"),
  32. );
  33. drupal_add_tabledrag($attr['id'], 'order', 'sibling', 'tabledrag-hide', NULL, NULL, FALSE);
  34. $rows = array();
  35. foreach (element_children($form[$region]) as $id) {
  36. $form[$region][$id]['weight']['#attributes'] = array('class' => array('tabledrag-hide'));
  37. $label = $form[$region][$id]['#value'];
  38. $remove = l(t('X'), $_GET['q'], array('fragment' => 'remove', 'attributes' => array('class' => array('remove'))));
  39. $rows[] = array(
  40. 'data' => array($label, drupal_render($form[$region][$id]['weight']), $remove),
  41. 'class' => array('draggable'),
  42. 'id' => $id,
  43. );
  44. }
  45. $output .= "<div class='label context-blockform-regionlabel-{$region}'>";
  46. $output .= l(t('+') . ' ' . t('Add'), $_GET['q'], array('fragment' => $region, 'attributes' => array('class' => array('add-block'))));
  47. $output .= $form[$region]['#title'];
  48. $output .= "</div>";
  49. $output .= theme('table', array('rows' => $rows, 'attributes' => $attr));
  50. }
  51. return $output;
  52. }
  53. /**
  54. * Use placeholder content for script tags that need to be replaced.
  55. */
  56. function theme_context_block_script_placeholder($vars) {
  57. $text = $vars['text'];
  58. $message = t('Please reload the page to view this block.');
  59. return "<div class='script-placeholder'><strong>{$text}</strong><div class='description'>{$message}</div></div>";
  60. }
  61. /**
  62. * Preprocessor for theme('context_block_browser').
  63. */
  64. function template_preprocess_context_block_browser(&$vars) {
  65. $categories = array(
  66. '#type' => 'select',
  67. '#options' => array(0 => '<' . t('All Categories') . '>'),
  68. '#attributes' => array('class' => array('context-block-browser-categories')),
  69. '#value' => 0,
  70. '#size' => 1,
  71. '#id' => '',
  72. '#name' => '',
  73. '#parents' => array(''),
  74. '#multiple' => FALSE,
  75. '#required' => FALSE,
  76. );
  77. $blocks = array();
  78. // Group blocks by module.
  79. foreach ($vars['blocks'] as $block) {
  80. $group = isset($block->context_group) ? $block->context_group : $block->module;
  81. // Normalize the $group, borrowed from drupal_html_id
  82. $group = strtr(drupal_strtolower($group), array(' ' => '-', '_' => '-', '[' => '-', ']' => ''));
  83. if (!isset($categories[$group])) {
  84. $info = system_get_info('module', $block->module);
  85. $title = isset($block->context_group) ? $block->context_group : (!empty($info['name']) ? $info['name'] : $block->module);
  86. $categories['#options'][$group] = $title;
  87. }
  88. $blocks[$group][$block->bid] = $block; // Don't call theme('context_block_browser_item') to allow others to alter.
  89. }
  90. //add help text to tell people how to use the block browser
  91. $help_text = array(
  92. '#prefix' => '<div class="context_ui-help-text">',
  93. '#markup' => t('To add a block to the current region, simply click on the block. You may use the category filter to filter by
  94. block type or the search filter to find the block that you wish to add.'),
  95. '#suffix' => '</div>',
  96. );
  97. $filter_label = array(
  98. '#prefix' => '<div class="filter-label">',
  99. '#markup' => t('Search Filter'),
  100. '#suffix' => '</div>',
  101. );
  102. $vars['categories'] = $categories; // Don't call theme('select') here to allow further preprocesses to alter the element.
  103. $vars['blocks'] = $blocks;
  104. $vars['help_text'] = $help_text;
  105. $vars['filter_label'] = $filter_label;
  106. }
  107. /**
  108. * Preprocessor for theme('context_block_browser_item').
  109. */
  110. function template_preprocess_context_block_browser_item(&$vars) {
  111. $vars['bid'] = $vars['block']->bid;
  112. $vars['info'] = check_plain($vars['block']->info);
  113. }
  114. /**
  115. * Theme wrapper for editable blocks.
  116. *
  117. * @ingroup themeable
  118. */
  119. function theme_context_block_edit_wrap($vars) {
  120. $block = $vars['element']['#block'];
  121. return $vars['element']['#children'] . "<a id='context-block-{$block->module}-{$block->delta}' class='context-block editable edit-{$block->context}'></a>";
  122. }
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.