hosting_server.api.php

Hooks provided by the hosting server module.

Functions

Namesort descending Description
hook_hosting_servers_titles_alter Alter the servers available for selection in the frontend.

File

server/hosting_server.api.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Hooks provided by the hosting server module.
  5. */
  6. /**
  7. * @addtogroup hostinghooks
  8. * @{
  9. */
  10. /**
  11. * Alter the servers available for selection in the frontend.
  12. *
  13. * You can use this hook to modify the servers a user can choose from in the
  14. * frontend when selecting things like which server to deploy a platform to, or
  15. * which server to use for a site's database.
  16. *
  17. * In most cases all you'll want to do is either modify the title of the server,
  18. * which is for the user's informational purposes only, or remove servers so
  19. * they can't choose it. Removing servers from this list may not be supported by
  20. * the code getting the list of servers, so be very careful if you do this.
  21. *
  22. * @param $servers
  23. * An array of enabled servers, keys are the nid's of the nodes representing
  24. * them, values are the titles of the servers.
  25. * @param $service
  26. * Service type string, like 'http' or 'db'.
  27. *
  28. * @see hosting_get_servers()
  29. */
  30. function hook_hosting_servers_titles_alter(&$servers, $service) {
  31. // Append the string 'SERVER' to all server titles.
  32. foreach ($servers as $nid => $title) {
  33. $servers[$nid] .= 'SERVER';
  34. }
  35. // Don't allow the user to use the server with $nid == 123, for the 'db' service
  36. if ($service == 'db') {
  37. unset($servers[123]);
  38. }
  39. }
  40. /**
  41. * @} End of "addtogroup hooks".
  42. */