features.module 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * @file
  4. * Main hooks for Features module.
  5. */
  6. use Drupal\Core\Routing\RouteMatchInterface;
  7. /**
  8. * Implements hook_help().
  9. */
  10. function features_help($route_name, RouteMatchInterface $route_match) {
  11. switch ($route_name) {
  12. case 'help.page.features':
  13. $output = '';
  14. $output .= '<h3>' . t('About') . '</h3>';
  15. $output .= '<p>' . t('The Features module provides a user interface for exporting bundles of configuration into modules. For more information, see the online documentation for <a href=":url">Features module</a>', array(
  16. ':url' => 'http://drupal.org/node/2404427',
  17. )) . '</p>';
  18. return $output;
  19. }
  20. }
  21. /**
  22. * Implements hook_file_download().
  23. */
  24. function features_file_download($uri) {
  25. $scheme = file_uri_scheme($uri);
  26. $target = file_uri_target($uri);
  27. if ($scheme == 'temporary' && $target) {
  28. return array(
  29. 'Content-disposition' => 'attachment; filename="' . $target . '"',
  30. );
  31. }
  32. }
  33. /**
  34. * Implements hook_modules_installed().
  35. */
  36. function features_modules_installed($modules) {
  37. if (!in_array('features', $modules)) {
  38. /** @var \Drupal\features\FeaturesAssignerInterface $assigner */
  39. $assigner = \Drupal::service('features_assigner');
  40. $assigner->purgeConfiguration();
  41. }
  42. }