alter.inc

  1. cis7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/alter.inc
  2. cle7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/alter.inc
  3. ecd7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/alter.inc
  4. elmsmedia7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/alter.inc
  5. harmony7 sites/all/themes/local_contrib/bootstrap/theme/alter.inc
  6. harmony7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/alter.inc
  7. icor7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/alter.inc
  8. meedjum_blog7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/alter.inc
  9. mooc7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/alter.inc

General alters.

Functions

Namesort descending Description
adaptivetheme_css_alter hook_css_alter()
adaptivetheme_form_alter hook_form_FORM_alter()
adaptivetheme_form_node_form_alter hook_form_BASE_FORM_ID_alter() Modify field classes on node forms.
adaptivetheme_form_search_form_alter hook_form_FORM_ID_alter() Modify the Advanced Search Form
adaptivetheme_form_user_login_block_alter hook_form_FORM_ID_alter() Modify the User Login Block Form
adaptivetheme_html_head_alter hook_html_head_alter()
adaptivetheme_js_alter hook_js_alter()
adaptivetheme_page_alter hook_page_alter()
adaptivetheme_wysiwyg_editor_settings_alter Set a class on the iframe body element for WYSIWYG editors. This allows you to easily override the background for the iframe body element. This only works for the WYSIWYG module: http://drupal.org/project/wysiwyg
at_debug_panels Output for the debug panels test. This is pretty sucky because its hard coded and therefor does not include any custom Panels layout plugins you might include in a subtheme, bad eh?
at_move_regions

File

sites/all/themes/ulmus/adaptivetheme/at_core/inc/alter.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * General alters.
  5. */
  6. /**
  7. * hook_html_head_alter()
  8. */
  9. function adaptivetheme_html_head_alter(&$head_elements) {
  10. global $theme_key;
  11. $theme_name = $theme_key;
  12. // charset utf-8
  13. $head_elements['system_meta_content_type']['#attributes'] = array('charset' => 'utf-8');
  14. // IE Document Mode
  15. if ($adaptivetheme_meta_ie_document_mode = at_get_setting('adaptivetheme_meta_ie_document_mode', $theme_name)) {
  16. $head_elements['adaptivetheme_meta_ie_document_mode'] = array(
  17. '#type' => 'html_tag',
  18. '#tag' => 'meta',
  19. '#attributes' => array(
  20. 'http-equiv' => "X-UA-Compatible",
  21. 'content' => $adaptivetheme_meta_ie_document_mode,
  22. ),
  23. '#weight' => -999, // 1 less than the charset
  24. );
  25. }
  26. // cleartype
  27. if (at_get_setting('adaptivetheme_meta_clear_type', $theme_name) === 1) {
  28. $head_elements['adaptivetheme_meta_clear_type'] = array(
  29. '#type' => 'html_tag',
  30. '#tag' => 'meta',
  31. '#attributes' => array(
  32. 'http-equiv' => "cleartype",
  33. 'content' => "on",
  34. ),
  35. '#weight' => -998,
  36. );
  37. }
  38. // Don't add these if responsive styles are disabled
  39. if (at_get_setting('disable_responsive_styles', $theme_name) === 0) {
  40. // Viewport
  41. if ($adaptivetheme_meta_viewport = at_get_setting('adaptivetheme_meta_viewport', $theme_name)) {
  42. $head_elements['adaptivetheme_meta_viewport'] = array(
  43. '#type' => 'html_tag',
  44. '#tag' => 'meta',
  45. '#attributes' => array(
  46. 'name' => 'viewport',
  47. 'content' => check_plain($adaptivetheme_meta_viewport),
  48. ),
  49. '#weight' => 1,
  50. );
  51. }
  52. // MobileOptimized
  53. if ($adaptivetheme_meta_mobileoptimized = at_get_setting('adaptivetheme_meta_mobileoptimized', $theme_name)) {
  54. $head_elements['adaptivetheme_meta_mobileoptimized'] = array(
  55. '#type' => 'html_tag',
  56. '#tag' => 'meta',
  57. '#attributes' => array(
  58. 'name' => "MobileOptimized",
  59. 'content' => check_plain($adaptivetheme_meta_mobileoptimized),
  60. ),
  61. '#weight' => 2,
  62. );
  63. }
  64. // HandheldFriendly
  65. if ($adaptivetheme_meta_handheldfriendly = at_get_setting('adaptivetheme_meta_handheldfriendly', $theme_name)) {
  66. $head_elements['adaptivetheme_meta_handheldfriendly'] = array(
  67. '#type' => 'html_tag',
  68. '#tag' => 'meta',
  69. '#attributes' => array(
  70. 'name' => "HandheldFriendly",
  71. 'content' => check_plain($adaptivetheme_meta_handheldfriendly),
  72. ),
  73. '#weight' => 3,
  74. );
  75. }
  76. // apple-mobile-web-app-capable
  77. if ($adaptivetheme_meta_apple_mobile_web_app_capable = at_get_setting('adaptivetheme_meta_apple_mobile_web_app_capable', $theme_name)) {
  78. $head_elements['adaptivetheme_meta_apple_mobile_web_app_capable'] = array(
  79. '#type' => 'html_tag',
  80. '#tag' => 'meta',
  81. '#attributes' => array(
  82. 'name' => "apple-mobile-web-app-capable",
  83. 'content' => check_plain($adaptivetheme_meta_apple_mobile_web_app_capable),
  84. ),
  85. '#weight' => 4,
  86. );
  87. }
  88. }
  89. // Apple touch icons - low, medium and high (see the Apple docs on touch icons)
  90. if (at_get_setting('enable_apple_touch_icons') === 1) {
  91. $path_to_theme = drupal_get_path('theme', $theme_name);
  92. $rel = 'apple-touch-icon';
  93. if (at_get_setting('enable_apple_touch_icon_precomposed') === 1) {
  94. $rel = 'apple-touch-icon-precomposed';
  95. }
  96. // Apple default icon and Nokia shortcut icon.
  97. $icon_path_default = check_plain(at_get_setting('icon_path_default', $theme_name));
  98. if (!empty($icon_path_default)) {
  99. $default_icon_path = $path_to_theme . '/' . $icon_path_default;
  100. $default_icon_url = file_create_url($default_icon_path);
  101. $head_elements['adaptivetheme_touch_icon_nokia'] = array(
  102. '#type' => 'html_tag',
  103. '#tag' => 'link',
  104. '#weight' => -97,
  105. '#attributes' => array(
  106. 'href' => $default_icon_url,
  107. 'rel' => "shortcut icon",
  108. ),
  109. );
  110. $head_elements['adaptivetheme_touch_icon_default'] = array(
  111. '#type' => 'html_tag',
  112. '#tag' => 'link',
  113. '#weight' => -98,
  114. '#attributes' => array(
  115. 'href' => $default_icon_url,
  116. 'rel' => $rel,
  117. ),
  118. );
  119. }
  120. // iPad (standard display).
  121. $apple_touch_icon_path_ipad = check_plain(at_get_setting('apple_touch_icon_path_ipad', $theme_name));
  122. if (!empty($apple_touch_icon_path_ipad)) {
  123. $ipad_icon_path = $path_to_theme . '/' . $apple_touch_icon_path_ipad;
  124. $ipad_icon_url = file_create_url($ipad_icon_path);
  125. $head_elements['adaptivetheme_touch_icon_ipad'] = array(
  126. '#type' => 'html_tag',
  127. '#tag' => 'link',
  128. '#weight' => -99,
  129. '#attributes' => array(
  130. 'href' => $ipad_icon_url,
  131. 'rel' => $rel,
  132. 'sizes' => "76x76",
  133. ),
  134. );
  135. }
  136. // iPhone retina.
  137. $apple_touch_icon_path_iphone_retina = check_plain(at_get_setting('apple_touch_icon_path_iphone_retina', $theme_name));
  138. if (!empty($apple_touch_icon_path_iphone_retina)) {
  139. $iphone_retina_icon_path = $path_to_theme . '/' . $apple_touch_icon_path_iphone_retina;
  140. $iphone_retina_icon_url = file_create_url($iphone_retina_icon_path);
  141. $head_elements['adaptivetheme_touch_icon_iphone_retina'] = array(
  142. '#type' => 'html_tag',
  143. '#tag' => 'link',
  144. '#weight' => -100,
  145. '#attributes' => array(
  146. 'href' => $iphone_retina_icon_url,
  147. 'rel' => $rel,
  148. 'sizes' => "120x120",
  149. ),
  150. );
  151. }
  152. // iPad retina.
  153. $apple_touch_icon_path_ipad_retina = check_plain(at_get_setting('apple_touch_icon_path_ipad_retina', $theme_name));
  154. if (!empty($apple_touch_icon_path_ipad_retina)) {
  155. $ipad_retina_icon_path = $path_to_theme . '/' . $apple_touch_icon_path_ipad_retina;
  156. $ipad_retina_icon_url = file_create_url($ipad_retina_icon_path);
  157. $head_elements['adaptivetheme_touch_icon_ipad_retina'] = array(
  158. '#type' => 'html_tag',
  159. '#tag' => 'link',
  160. '#weight' => -100,
  161. '#attributes' => array(
  162. 'href' => $ipad_retina_icon_url,
  163. 'rel' => $rel,
  164. 'sizes' => "152x152",
  165. ),
  166. );
  167. }
  168. }
  169. }
  170. /**
  171. * hook_js_alter()
  172. */
  173. function adaptivetheme_js_alter(&$javascript) {
  174. global $theme_key;
  175. // Use our own vesion of vertical-tabs.js for better error handling
  176. // @see http://drupal.org/node/607752
  177. if (isset($javascript['misc/vertical-tabs.js'])) {
  178. $file = drupal_get_path('theme', 'adaptivetheme') . '/scripts/vertical-tabs.js';
  179. $javascript['misc/vertical-tabs.js'] = drupal_js_defaults($file);
  180. }
  181. // Combine JS files into one per type, this is a bit mad and
  182. // we probably shouldn't encourage such things :)
  183. if (at_get_setting('combine_js_files', $theme_key) === 1) {
  184. uasort($javascript, 'drupal_sort_css_js');
  185. $weight = 0;
  186. foreach ($javascript as $name => $script) {
  187. $javascript[$name]['group'] = -100;
  188. $javascript[$name]['weight'] = ++$weight;
  189. $javascript[$name]['every_page'] = 1;
  190. }
  191. }
  192. }
  193. /**
  194. * hook_css_alter()
  195. */
  196. function adaptivetheme_css_alter(&$css) {
  197. global $theme_key;
  198. // Never allow this to run in our admin theme and only if the extension is enabled.
  199. if (at_get_setting('enable_exclude_css') === 1 && $theme_key !== 'adaptivetheme_admin') {
  200. // Get $css_data from the cache
  201. if ($cache = cache_get('at_get_css_files')) {
  202. $css_data = $cache->data;
  203. }
  204. else {
  205. $css_data = at_get_css_files($theme_key);
  206. }
  207. // We need the right theme name to get the theme settings
  208. $_get_active_theme_data = array_pop($css_data);
  209. if ($_get_active_theme_data['type'] == 'theme') {
  210. $theme_name = $_get_active_theme_data['source'];
  211. }
  212. else {
  213. $theme_name = $theme_key;
  214. }
  215. // Get the theme setting and unset files
  216. foreach ($css_data as $key => $value) {
  217. $setting = 'unset_css_' . preg_replace('/[^a-zA-Z0-9-]+/', '_', $key);
  218. if (at_get_setting($setting, $theme_name) === 1) {
  219. if (isset($css[$key])) {
  220. unset($css[$key]);
  221. }
  222. }
  223. }
  224. // Unset -rtl.css files if language dir is RTL, in some contexts dir is
  225. // unset, but I don't know if this is a core bug or not.
  226. if (isset($language->dir) && $language->dir === 'rtl') {
  227. foreach ($css_data as $key => $value) {
  228. $setting = 'unset_css_' . preg_replace('/[^a-zA-Z0-9-]+/', '_', $key);
  229. if (at_get_setting($setting, $theme_name) === 1) {
  230. $key = str_replace('.css', '-rtl.css', $key);
  231. if (isset($css[$key])) {
  232. unset($css[$key]);
  233. }
  234. }
  235. }
  236. }
  237. }
  238. // Combine CSS files into one per type, this is not perfect
  239. if (at_get_setting('combine_css_files', $theme_key) === 1) {
  240. uasort($css, 'drupal_sort_css_js');
  241. $print = array();
  242. $weight = 0;
  243. foreach ($css as $name => $style) {
  244. // Leave the conditional stylesheets untouched
  245. if ($css[$name]['browsers']['!IE']) {
  246. $css[$name]['group'] = 0;
  247. $css[$name]['weight'] = $weight++;
  248. $css[$name]['every_page'] = TRUE;
  249. }
  250. if ($css[$name]['media'] == 'print') {
  251. $print[$name] = $css[$name];
  252. unset($css[$name]);
  253. }
  254. }
  255. $css = array_merge($css, $print);
  256. }
  257. }
  258. /**
  259. * hook_page_alter()
  260. */
  261. function adaptivetheme_page_alter(&$page) {
  262. global $theme_key;
  263. $theme_name = $theme_key;
  264. // Get the menu item
  265. $menu_item = menu_get_item();
  266. // Theme taxonomy term pages sensibly, remove redundant and potentially empty
  267. // markup and wrap the node list in section elements with a class for theming.
  268. if ($menu_item['tab_root'] == 'taxonomy/term/%') {
  269. unset($page['content']['system_main']['term_heading']['#prefix']);
  270. unset($page['content']['system_main']['term_heading']['#suffix']);
  271. $page['content']['system_main']['nodes']['#prefix'] = '<section class="nodes">';
  272. $page['content']['system_main']['nodes']['#suffix'] = '</section>';
  273. }
  274. if (at_get_setting('enable_extensions', $theme_name) === 1) {
  275. if (at_get_setting('enable_markup_overides', $theme_name) === 1) {
  276. // Remove block system main, just from the front page
  277. if (drupal_is_front_page()) {
  278. if (at_get_setting('unset_block_system_main_front', $theme_name) === 1) {
  279. $page['content']['system_main']['#access'] = FALSE; // Brutal but effective
  280. }
  281. }
  282. }
  283. }
  284. // Get all the regions with blocks
  285. $block_regions = &drupal_static(__FUNCTION__, array());
  286. if (empty($blocks_regions)) {
  287. $block_regions = system_region_list($GLOBALS['theme'], REGIONS_VISIBLE);
  288. }
  289. // Setup the detection environment
  290. $detection = variable_get('at_detection', 0);
  291. if ($detection == 1) {
  292. $browscap_detect = variable_get('at_browscap_detect', 0);
  293. $mobile_detect = variable_get('at_mobile_detect', 0);
  294. $browser = at_get_browser();
  295. $page['is_mobile'] = $browser['is_mobile'];
  296. $page['is_tablet'] = $browser['is_tablet'];
  297. }
  298. else {
  299. $page['is_mobile'] = FALSE;
  300. $page['is_tablet'] = FALSE;
  301. }
  302. // Look in each visible region for blocks
  303. foreach ($block_regions as $region => $name) {
  304. if (!empty($page[$region])) {
  305. // Find the last block in the region
  306. $blocks = array_reverse(element_children($page[$region]));
  307. while ($blocks && !isset($page[$region][$blocks[0]]['#block'])) {
  308. array_shift($blocks);
  309. }
  310. if ($blocks) {
  311. // Set a bool for the last class for blocks feature
  312. $page[$region][$blocks[0]]['#block']->last_in_region = TRUE;
  313. // Alter regions and block visibility. Note that ideally this would all
  314. // be better in hook_page_build(), however themes can't fire that hook.
  315. if (at_get_setting('enable_extensions', $theme_name) === 1) {
  316. if (at_get_setting('enable_context_regions') === 1) {
  317. // UNSET
  318. if (at_get_setting('unset_' . $region) === 1) {
  319. if (at_get_setting('unset_options_' . $region) == 'unset_smalltouch') {
  320. if ($page['is_mobile'] === TRUE && $page['is_tablet'] === FALSE) {
  321. unset($page[$region]);
  322. }
  323. }
  324. else {
  325. // this is the all option
  326. if ($page['is_mobile'] === TRUE) {
  327. unset($page[$region]);
  328. }
  329. }
  330. }
  331. // MOVE
  332. if (at_get_setting('move_region_' . $region) === 1) {
  333. if (at_get_setting('move_options_' . $region) == 'move_smalltouch') {
  334. if ($page['is_mobile'] === TRUE && $page['is_tablet'] === FALSE) {
  335. $page = at_move_regions($page, $region, $blocks);
  336. }
  337. }
  338. else {
  339. // this is the all option
  340. if ($page['is_mobile'] === TRUE) {
  341. $page = at_move_regions($page, $region, $blocks);
  342. }
  343. }
  344. }
  345. }
  346. }
  347. }
  348. }
  349. }
  350. // Run the panels test
  351. if (theme_get_setting('load_all_panels') === 1) {
  352. if (drupal_is_front_page()) {
  353. $page['content']['#markup'] = at_debug_panels();
  354. if (theme_get_setting('load_all_panels_no_sidebars') === 1) {
  355. unset($page['sidebar_first']);
  356. unset($page['sidebar_second']);
  357. }
  358. }
  359. }
  360. //kpr($page);
  361. }
  362. // Abstrat move regions processing
  363. function at_move_regions($page, $region, $blocks) {
  364. // Get the target region if set, check blocks can move and its not set to unset
  365. if (($target_region = at_get_setting('move_' . $region)) && ($target_region !== 'do_not_move') && (at_get_setting('unset_' . $region) !== 1)) {
  366. // Sanitize possible vector
  367. $target_region = check_plain($target_region);
  368. // Initialize the classes array
  369. $classes = array();
  370. // Move each block
  371. foreach ($blocks as $block) {
  372. // If the $target_region is empty the region markup does not print
  373. // so we need to generate it manually. This is bad because it
  374. // cannot account for region specific template suggestions and
  375. // Adaptivethemes own region prefix and suffix wrappers.
  376. if (empty($page[$target_region])) {
  377. $classes[] = 'region';
  378. $classes[] = 'region-' . str_replace('_', '-', $target_region);
  379. if ($target_region == 'sidebar_first' || $target_region == 'sidebar_second') {
  380. $classes[] = 'sidebar';
  381. }
  382. $classes = implode(' ', $classes);
  383. $page[$target_region]['#prefix'] = '<div class="' . $classes . '"><div class="region-inner clearfix">';
  384. $page[$target_region]['#suffix'] = '</div></div>';
  385. }
  386. // Move the blocks to the target region
  387. $page[$target_region][$block] = $page[$region][$block];
  388. // Unset the original block
  389. unset($page[$region][$block]);
  390. }
  391. // Unset the region, all blocks are now moved
  392. unset($page[$region]);
  393. }
  394. return $page;
  395. }
  396. /**
  397. * hook_form_FORM_alter()
  398. */
  399. function adaptivetheme_form_alter(&$form, &$form_state, $form_id) {
  400. // Collapse Noggin fieldset by default
  401. if ($form_id == 'system_theme_settings') {
  402. if (module_exists('noggin')) {
  403. $form['noggin']['#collapsible'] = TRUE;
  404. $form['noggin']['#collapsed'] = TRUE;
  405. }
  406. }
  407. }
  408. /**
  409. * hook_form_FORM_ID_alter()
  410. * Modify the Advanced Search Form
  411. */
  412. function adaptivetheme_form_search_form_alter(&$form, $form_state) {
  413. // The problem with Drupals standard Advanced search form is that each
  414. // criterion group is wrapped in a DIV, whereas it should be a fieldset with
  415. // a legend, this is better semantics and improves accessibility by
  416. // logically grouping field items. We make this optional via a theme setting,
  417. // beacuse some people bitched that it broke some modules that require
  418. // crappy markup.
  419. if (at_get_setting('adv_search_extra_fieldsets') === 1) {
  420. if (isset($form['module']) && $form['module']['#value'] == 'node' && user_access('use advanced search')) {
  421. // Keyword boxes:
  422. $form['advanced'] = array(
  423. '#type' => 'fieldset',
  424. '#title' => t('Advanced search'),
  425. '#collapsible' => TRUE,
  426. '#collapsed' => TRUE,
  427. '#attributes' => array('class' => array('search-advanced')),
  428. );
  429. $form['advanced']['keywords-fieldset'] = array(
  430. '#type' => 'fieldset',
  431. '#title' => t('Keywords'),
  432. '#collapsible' => FALSE,
  433. );
  434. $form['advanced']['keywords-fieldset']['keywords'] = array(
  435. '#prefix' => '<div class="criterion">',
  436. '#suffix' => '</div>',
  437. );
  438. $form['advanced']['keywords-fieldset']['keywords']['or'] = array(
  439. '#type' => 'textfield',
  440. '#title' => t('Containing any of the words'),
  441. '#size' => 30,
  442. '#maxlength' => 255,
  443. );
  444. $form['advanced']['keywords-fieldset']['keywords']['phrase'] = array(
  445. '#type' => 'textfield',
  446. '#title' => t('Containing the phrase'),
  447. '#size' => 30,
  448. '#maxlength' => 255,
  449. );
  450. $form['advanced']['keywords-fieldset']['keywords']['negative'] = array(
  451. '#type' => 'textfield',
  452. '#title' => t('Containing none of the words'),
  453. '#size' => 30,
  454. '#maxlength' => 255,
  455. );
  456. // Node types:
  457. $types = array_map('check_plain', node_type_get_names());
  458. $form['advanced']['types-fieldset'] = array(
  459. '#type' => 'fieldset',
  460. '#title' => t('Types'),
  461. '#collapsible' => FALSE,
  462. );
  463. $form['advanced']['types-fieldset']['type'] = array(
  464. '#type' => 'checkboxes',
  465. '#prefix' => '<div class="criterion">',
  466. '#suffix' => '</div>',
  467. '#options' => $types,
  468. );
  469. $form['advanced']['submit'] = array(
  470. '#type' => 'submit',
  471. '#value' => t('Advanced search'),
  472. '#prefix' => '<div class="action advanced-search-submit">',
  473. '#suffix' => '</div>',
  474. '#weight' => 99,
  475. );
  476. // Languages:
  477. $language_options = array();
  478. foreach (language_list('language') as $key => $entity) {
  479. $language_options[$key] = $entity->name;
  480. }
  481. if (count($language_options) > 1) {
  482. $form['advanced']['lang-fieldset'] = array(
  483. '#type' => 'fieldset',
  484. '#title' => t('Languages'),
  485. '#collapsible' => FALSE,
  486. '#collapsed' => FALSE,
  487. );
  488. $form['advanced']['lang-fieldset']['language'] = array(
  489. '#type' => 'checkboxes',
  490. '#prefix' => '<div class="criterion">',
  491. '#suffix' => '</div>',
  492. '#options' => $language_options,
  493. );
  494. }
  495. $form['#validate'][] = 'node_search_validate';
  496. }
  497. }
  498. }
  499. /**
  500. * hook_form_FORM_ID_alter()
  501. * Modify the User Login Block Form
  502. */
  503. function adaptivetheme_form_user_login_block_alter(&$form, &$form_state, $form_id) {
  504. global $theme_key;
  505. $theme_name = $theme_key;
  506. if (at_get_setting('enable_extensions', $theme_name) === 1) {
  507. if (at_get_setting('enable_markup_overides', $theme_name) === 1) {
  508. if (at_get_setting('login_block_remove_links', $theme_name) === 1) {
  509. // Remove the links
  510. if (isset($form['links'])) {
  511. unset($form['links']);
  512. }
  513. }
  514. if (at_get_setting('login_block_remove_openid', $theme_name) === 1) {
  515. if (module_exists('openid')) {
  516. // Remove OpenID elements
  517. unset($form['openid_links']);
  518. unset($form['openid_identifier']);
  519. unset($form['openid.return_to']);
  520. }
  521. }
  522. if (at_get_setting('horizontal_login_block', $theme_name) === 1) {
  523. // Move the links to the end of the form, so they are after the submit,
  524. // OpenID really messes up the weight and I can't be bothered fighting
  525. // Drupal to deal with it.
  526. if (isset($form['links'])) {
  527. $form['links']['#weight'] = 100;
  528. }
  529. }
  530. }
  531. }
  532. }
  533. /**
  534. * hook_form_BASE_FORM_ID_alter()
  535. * Modify field classes on node forms.
  536. */
  537. function adaptivetheme_form_node_form_alter(&$form, &$form_state, $form_id) {
  538. // Remove if #1245218 is backported to D7 core.
  539. foreach (array_keys($form) as $item) {
  540. if (strpos($item, 'field_') === 0) {
  541. if (!empty($form[$item]['#attributes']['class'])) {
  542. foreach ($form[$item]['#attributes']['class'] as &$class) {
  543. if (strpos($class, 'field-type-') === 0 || strpos($class, 'field-name-') === 0) {
  544. // Make the class different from that used in theme_field().
  545. $class = $class . '-form';
  546. }
  547. }
  548. }
  549. }
  550. }
  551. }
  552. /**
  553. * Set a class on the iframe body element for WYSIWYG editors. This allows you
  554. * to easily override the background for the iframe body element.
  555. * This only works for the WYSIWYG module: http://drupal.org/project/wysiwyg
  556. */
  557. function adaptivetheme_wysiwyg_editor_settings_alter(&$settings, &$context) {
  558. $settings['bodyClass'] = 'wysiwygeditor';
  559. }
  560. /**
  561. * Output for the debug panels test. This is pretty sucky because its
  562. * hard coded and therefor does not include any custom Panels layout
  563. * plugins you might include in a subtheme, bad eh?
  564. */
  565. function at_debug_panels() {
  566. $output = <<<EOF
  567. <div class="all-panel-layouts debug-panels">
  568. <h1>Panels/Gpanels Layout Test</h1>
  569. <p>To disable this test uncheck the theme setting <em>Debuggers > Load all panels in the front page content region</em></p>
  570. <div class="at-panel panel-display one-column clearfix">
  571. <div class="region region-one-main">
  572. <div class="region-inner clearfix">
  573. </div>
  574. </div>
  575. </div>
  576. <div class="at-panel panel-display two-50 clearfix">
  577. <div class="region region-two-50-top region-conditional-stack">
  578. <div class="region-inner clearfix">
  579. </div>
  580. </div>
  581. <div class="region region-two-50-first">
  582. <div class="region-inner clearfix">
  583. </div>
  584. </div>
  585. <div class="region region-two-50-second">
  586. <div class="region-inner clearfix">
  587. </div>
  588. </div>
  589. <div class="region region-two-50-bottom region-conditional-stack">
  590. <div class="region-inner clearfix">
  591. </div>
  592. </div>
  593. </div>
  594. <div class="at-panel panel-display two-33-66 clearfix">
  595. <div class="region region-two-33-66-top region-conditional-stack">
  596. <div class="region-inner clearfix">
  597. </div>
  598. </div>
  599. <div class="region region-two-33-66-first">
  600. <div class="region-inner clearfix">
  601. </div>
  602. </div>
  603. <div class="region region-two-33-66-second">
  604. <div class="region-inner clearfix">
  605. </div>
  606. </div>
  607. <div class="region region-two-33-66-bottom region-conditional-stack">
  608. <div class="region-inner clearfix">
  609. </div>
  610. </div>
  611. </div>
  612. <div class="at-panel panel-display two-66-33 clearfix">
  613. <div class="region region-two-66-33-top region-conditional-stack">
  614. <div class="region-inner clearfix">
  615. </div>
  616. </div>
  617. <div class="region region-two-66-33-first">
  618. <div class="region-inner clearfix">
  619. </div>
  620. </div>
  621. <div class="region region-two-66-33-second">
  622. <div class="region-inner clearfix">
  623. </div>
  624. </div>
  625. <div class="region region-two-66-33-bottom region-conditional-stack">
  626. <div class="region-inner clearfix">
  627. </div>
  628. </div>
  629. </div>
  630. <div class="at-panel panel-display two-brick clearfix">
  631. <div class="region region-two-brick-top region-conditional-stack">
  632. <div class="region-inner clearfix">
  633. </div>
  634. </div>
  635. <div class="panel-row row-1 clearfix">
  636. <div class="region region-two-brick-left-above">
  637. <div class="region-inner clearfix">
  638. </div>
  639. </div>
  640. <div class="region region-two-brick-right-above">
  641. <div class="region-inner clearfix">
  642. </div>
  643. </div>
  644. </div>
  645. <div class="region region-two-brick-middle region-conditional-stack">
  646. <div class="region-inner clearfix">
  647. </div>
  648. </div>
  649. <div class="panel-row row-2 clearfix">
  650. <div class="region region-two-brick-left-below">
  651. <div class="region-inner clearfix">
  652. </div>
  653. </div>
  654. <div class="region region-two-brick-right-below">
  655. <div class="region-inner clearfix">
  656. </div>
  657. </div>
  658. </div>
  659. <div class="region region-two-brick-bottom region-conditional-stack">
  660. <div class="region-inner clearfix">
  661. </div>
  662. </div>
  663. </div>
  664. <div class="at-panel panel-display three-3x33 clearfix">
  665. <div class="region region-three-33-top region-conditional-stack">
  666. <div class="region-inner clearfix">
  667. </div>
  668. </div>
  669. <div class="region region-three-33-first">
  670. <div class="region-inner clearfix">
  671. </div>
  672. </div>
  673. <div class="region region-three-33-second">
  674. <div class="region-inner clearfix">
  675. </div>
  676. </div>
  677. <div class="region region-three-33-third">
  678. <div class="region-inner clearfix">
  679. </div>
  680. </div>
  681. <div class="region region-three-33-bottom region-conditional-stack">
  682. <div class="region-inner clearfix">
  683. </div>
  684. </div>
  685. </div>
  686. <div class="at-panel panel-display three-25-50-25 clearfix">
  687. <div class="region region-three-25-50-25-top region-conditional-stack">
  688. <div class="region-inner clearfix">
  689. </div>
  690. </div>
  691. <div class="region region-three-25-50-25-first">
  692. <div class="region-inner clearfix">
  693. </div>
  694. </div>
  695. <div class="region region-three-25-50-25-second">
  696. <div class="region-inner clearfix">
  697. </div>
  698. </div>
  699. <div class="region region-three-25-50-25-third">
  700. <div class="region-inner clearfix">
  701. </div>
  702. </div>
  703. <div class="region region-three-25-50-25-bottom region-conditional-stack">
  704. <div class="region-inner clearfix">
  705. </div>
  706. </div>
  707. </div>
  708. <div class="at-panel panel-display three-25-25-50 clearfix">
  709. <div class="region region-three-25-25-50-top region-conditional-stack">
  710. <div class="region-inner clearfix">
  711. </div>
  712. </div>
  713. <div class="region region-three-25-25-50-first">
  714. <div class="region-inner clearfix">
  715. </div>
  716. </div>
  717. <div class="region region-three-25-25-50-second">
  718. <div class="region-inner clearfix">
  719. </div>
  720. </div>
  721. <div class="region region-three-25-25-50-third">
  722. <div class="region-inner clearfix">
  723. </div>
  724. </div>
  725. <div class="region region-three-25-25-50-bottom region-conditional-stack">
  726. <div class="region-inner clearfix">
  727. </div>
  728. </div>
  729. </div>
  730. <div class="at-panel panel-display three-50-25-25 clearfix">
  731. <div class="region region-three-50-25-25-top region-conditional-stack">
  732. <div class="region-inner clearfix">
  733. </div>
  734. </div>
  735. <div class="region region-three-50-25-25-first">
  736. <div class="region-inner clearfix">
  737. </div>
  738. </div>
  739. <div class="region region-three-50-25-25-second">
  740. <div class="region-inner clearfix">
  741. </div>
  742. </div>
  743. <div class="region region-three-50-25-25-third">
  744. <div class="region-inner clearfix">
  745. </div>
  746. </div>
  747. <div class="region region-three-50-25-25-bottom region-conditional-stack">
  748. <div class="region-inner clearfix">
  749. </div>
  750. </div>
  751. </div>
  752. <div class="at-panel panel-display four-4x25 clearfix">
  753. <div class="panel-row row-1 clearfix">
  754. <div class="region region-four-first">
  755. <div class="region-inner clearfix">
  756. </div>
  757. </div>
  758. <div class="region region-four-second">
  759. <div class="region-inner clearfix">
  760. </div>
  761. </div>
  762. </div>
  763. <div class="panel-row row-2 clearfix">
  764. <div class="region region-four-third">
  765. <div class="region-inner clearfix">
  766. </div>
  767. </div>
  768. <div class="region region-four-fourth">
  769. <div class="region-inner clearfix">
  770. </div>
  771. </div>
  772. </div>
  773. </div>
  774. <div class="at-panel panel-display five-5x20 clearfix">
  775. <div class="panel-row row-1 clearfix">
  776. <div class="region region-five-first">
  777. <div class="region-inner clearfix">
  778. </div>
  779. </div>
  780. <div class="region region-five-second">
  781. <div class="region-inner clearfix">
  782. </div>
  783. </div>
  784. </div>
  785. <div class="panel-row row-2 clearfix">
  786. <div class="region region-five-third">
  787. <div class="region-inner clearfix">
  788. </div>
  789. </div>
  790. <div class="region region-five-fourth">
  791. <div class="region-inner clearfix">
  792. </div>
  793. </div>
  794. <div class="region region-five-fifth">
  795. <div class="region-inner clearfix">
  796. </div>
  797. </div>
  798. </div>
  799. </div>
  800. <div class="at-panel panel-display six-6x16 multicolumn clearfix">
  801. <div class="panel-row row-1 clearfix">
  802. <div class="region region-six-first">
  803. <div class="region-inner clearfix">
  804. </div>
  805. </div>
  806. <div class="region region-six-second">
  807. <div class="region-inner clearfix">
  808. </div>
  809. </div>
  810. </div>
  811. <div class="panel-row row-2 clearfix">
  812. <div class="region region-six-third">
  813. <div class="region-inner clearfix">
  814. </div>
  815. </div>
  816. <div class="region region-six-fourth">
  817. <div class="region-inner clearfix">
  818. </div>
  819. </div>
  820. </div>
  821. <div class="panel-row row-3 clearfix">
  822. <div class="region region-six-fifth">
  823. <div class="region-inner clearfix">
  824. </div>
  825. </div>
  826. <div class="region region-six-sixth">
  827. <div class="region-inner clearfix">
  828. </div>
  829. </div>
  830. </div>
  831. </div>
  832. <div class="at-panel panel-panel three-inset-left clearfix">
  833. <div class="region region-three-inset-left-sidebar">
  834. <div class="region-inner clearfix">
  835. </div>
  836. </div>
  837. <div class="inset-wrapper clearfix">
  838. <div class="region region-three-inset-left-top region-conditional-stack">
  839. <div class="region-inner clearfix">
  840. </div>
  841. </div>
  842. <div class="region region-three-inset-left-middle">
  843. <div class="region-inner clearfix">
  844. </div>
  845. </div>
  846. <div class="region region-three-inset-left-inset">
  847. <div class="region-inner clearfix">
  848. </div>
  849. </div>
  850. <div class="region region-three-inset-left-bottom region-conditional-stack">
  851. <div class="region-inner clearfix">
  852. </div>
  853. </div>
  854. </div>
  855. </div>
  856. <div class="at-panel panel-panel three-inset-right clearfix">
  857. <div class="region region-three-inset-right-sidebar">
  858. <div class="region-inner clearfix">
  859. </div>
  860. </div>
  861. <div class="inset-wrapper clearfix">
  862. <div class="region region-three-inset-right-top region-conditional-stack">
  863. <div class="region-inner clearfix">
  864. </div>
  865. </div>
  866. <div class="region region-three-inset-right-middle">
  867. <div class="region-inner clearfix">
  868. </div>
  869. </div>
  870. <div class="region region-three-inset-right-inset">
  871. <div class="region-inner clearfix">
  872. </div>
  873. </div>
  874. <div class="region region-three-inset-right-bottom region-conditional-stack">
  875. <div class="region-inner clearfix">
  876. </div>
  877. </div>
  878. </div>
  879. </div>
  880. </div>
  881. EOF;
  882. return $output;
  883. }