modules.html 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <p>
  2. While skins can be provided in a theme, doing so has the potential
  3. disadvantage of making the skin available only to users of that theme (or
  4. themes based off of it). Many skins may be useful in any theme, or may provide
  5. building blocks that a particular theme could customize. When producing skins,
  6. please consider first whether you can make your work generic enough to provide
  7. in a module, thereby making it available to all Drupal users.
  8. </p>
  9. <p>The good news is that providing a skin in a module rather than a theme is
  10. quick and easy, even if you've never used PHP. In the steps below, we outline
  11. how to create a module for your skins. When creating your module, simply
  12. substitute occurrences of "block_skins" with a "machine name" (a name suitable
  13. for computers to read) of your choosing and change the description accordingly.
  14. Drupal module names typically are all lower case with no spaces and no
  15. punctuation except underscores (which are used to separate words).
  16. </p>
  17. <ol>
  18. <li>
  19. <p>Create a new folder in your modules directory using the machine name:</p>
  20. <pre>sites/all/modules/block_skins</pre>
  21. </li>
  22. <li>
  23. <p>
  24. Create a <code>block_skins.info</code> file inside the
  25. <code>block_skins</code> folder and include following code inside the
  26. file:
  27. </p>
  28. <pre>
  29. name = "Block Skins"
  30. description = "A set of skins providing configurable layout options for blocks."
  31. package = "Skinr"
  32. core = 6.x</pre>
  33. </li>
  34. <li>
  35. <p>
  36. Create a <code>block_skins.module</code> file inside the
  37. <code>block_skins</code> folder and include the following code inside the
  38. file:
  39. </p>
  40. <pre>
  41. &lt;?php
  42. /**
  43. * Implementation of hook_skinr_api().
  44. */
  45. function block_skins_skinr_api() {
  46. return array(
  47. 'api' => 1,
  48. 'path' => drupal_get_path('module', 'block_skins'),
  49. 'skins' => TRUE,
  50. );
  51. }</pre>
  52. <li>
  53. <p>
  54. Put your skins in a folder called <code>skins</code> inside your module's
  55. folder.
  56. </p>
  57. </li>
  58. </ol>
  59. <p>
  60. And that's it! You're ready to use and contribute your module, just like you
  61. would a theme. See the Drupal handbook documentation on
  62. <a href="http://drupal.org/node/7765">maintaining a project on drupal.org</a>.
  63. </p>