social_media_links.api.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /**
  3. * @file
  4. * API documentation for Social Media Links Block module.
  5. */
  6. /**
  7. * Defines all platforms by the module.
  8. *
  9. * @return array
  10. * An associative array whose keys define the key for the platform
  11. * (social network) and contains information about the platform. Each
  12. * platform description is itself an associative array, with the following
  13. * key-value pairs:
  14. * - title: (required) The name of the platform / social network.
  15. * - base url: (required) The base url for the platform (prefix) to
  16. * build the link:
  17. * {base url} + {user value} = link url
  18. * The base url will be shown on the configuration page before the
  19. * input field.
  20. * - link attributes:
  21. * - image alt: A optional alternativ text that will be used for the icon
  22. * alt attribute.
  23. */
  24. function hook_social_media_links_platform_info() {
  25. $platforms = array();
  26. // A simple example for twitter.
  27. $platforms['twitter'] = array(
  28. 'title' => t('Twitter'),
  29. 'base url' => 'http://www.twitter.com/',
  30. );
  31. // A expample for Google+ with an alternative alt text.
  32. $platforms['googleplus'] = array(
  33. 'title' => t('Google+'),
  34. 'base url' => 'https://plus.google.com/',
  35. 'image alt' => 'Google+ icon',
  36. );
  37. return $platforms;
  38. }
  39. /**
  40. * Change the platforms.
  41. *
  42. * @param array $platforms
  43. * A associative array with the defined platforms.
  44. */
  45. function hook_social_media_links_platform_info_alter(&$platforms) {
  46. // Change the title for Google Plus.
  47. $platforms['googleplus']['title'] = t('Google Plus');
  48. }
  49. /**
  50. * Defines the available iconsets.
  51. *
  52. * @return array
  53. * An associative array whose keys define the key for the iconset
  54. * and contains information about the icons for the platforms. Each
  55. * iconset deinition is itself an associative array, with the
  56. * following key-value pairs:
  57. * - name: The name of the iconset.
  58. * - publisher: The name of the publisher.
  59. * - publisher url: The url for further informations about the iconset.
  60. * - styles: The available sizes/styles for the iconset.
  61. * - path callback: The name of the callback function that returns the
  62. * image urls.
  63. * - download url: The url to download the iconset.
  64. */
  65. function hook_social_media_links_iconset_info() {
  66. // Simple example for a iconset definition.
  67. $icons['elegantthemes'] = array(
  68. 'name' => 'Elegant Themes Icons',
  69. 'publisher' => 'Elegant Themes',
  70. 'publisher url' => 'http://www.elegantthemes.com/',
  71. 'styles' => array(
  72. '32' => '32x32',
  73. ),
  74. 'path callback' => 'social_media_links_path_elegantthemes',
  75. 'download url' => 'http://www.elegantthemes.com/blog/resources/beautiful-free-social-media-icons',
  76. );
  77. return $icons;
  78. }
  79. /**
  80. * Change the iconset definitions.
  81. *
  82. * @param array $iconsets
  83. * A associative array with the defined iconsets.
  84. */
  85. function hook_social_media_links_iconset_info_alter(&$iconsets) {
  86. // Change the path callback for the elegantthemes.
  87. $iconsets['elegantthemes']['path callback'] = 'social_media_links_path_elegantthemes';
  88. }