less_demo.less.inc 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /**
  3. * @file
  4. * Contains implementations of Less module hooks.
  5. */
  6. /**
  7. * Implements hook_less_variables().
  8. */
  9. function less_demo_less_variables() {
  10. return array(
  11. '@text_glow' => 'black', // This will take precedence over .info file value.
  12. '@test' => '#ccc', // This value is defined for the first time here.
  13. );
  14. }
  15. /**
  16. * Implements hook_less_variables_alter().
  17. */
  18. function less_demo_less_variables_alter(&$less_variables, $system_name) {
  19. if ($system_name === 'less_demo') {
  20. $less_variables['@text_glow'] = 'blue';
  21. }
  22. }
  23. /**
  24. * Implements hook_less_variables_SYSTEM_NAME_alter().
  25. */
  26. function less_demo_less_variables_less_demo_alter(&$less_variables) {
  27. $less_variables['@test'] = 'green';
  28. }
  29. /**
  30. * Implements hook_less_functions().
  31. */
  32. function less_demo_less_functions() {
  33. return array(
  34. 'swap' => '_less_demo_reverse',
  35. );
  36. }
  37. /**
  38. * Implements hook_less_functions_alter().
  39. */
  40. function less_demo_less_functions_alter(&$less_functions, $system_name) {
  41. if ($system_name === 'less_demo') {
  42. }
  43. }
  44. /**
  45. * Implements hook_less_functions_SYSTEM_NAME_alter().
  46. */
  47. function less_demo_less_functions_less_demo_alter(&$less_functions) {
  48. }
  49. /**
  50. * Implements hook_less_paths().
  51. */
  52. function less_demo_less_paths() {
  53. return array(
  54. drupal_get_path('module', 'less_demo') . '/libs',
  55. );
  56. }
  57. /**
  58. * LESS function that takes a series of arguments and reverses their order.
  59. */
  60. function _less_demo_reverse($arg) {
  61. list($type, $delimiter, $value) = $arg;
  62. if ($type === 'list') {
  63. $arg = array($type, $delimiter, array_reverse($value));
  64. }
  65. return $arg;
  66. }