features.module
1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* @file
* Main hooks for Features module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function features_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.features':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$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(
':url' => 'http://drupal.org/node/2404427',
)) . '</p>';
return $output;
}
}
/**
* Implements hook_file_download().
*/
function features_file_download($uri) {
$scheme = file_uri_scheme($uri);
$target = file_uri_target($uri);
$session = \Drupal::request()->getSession();
if (isset($session)) {
$archive_name = $session->get('features_download');
if ($scheme == 'temporary' && $target == $archive_name) {
return array(
'Content-disposition' => 'attachment; filename="' . $archive_name . '"',
);
}
}
}
/**
* Implements hook_modules_installed().
*/
function features_modules_installed($modules) {
if (!in_array('features', $modules)) {
$assigner = \Drupal::service('features_assigner');
$assigner->purgeConfiguration();
}
}