aboutsummaryrefslogtreecommitdiff
path: root/video.features.inc
blob: a6176b4c6ea24c267a84b323732b18127d6aa8b3 (plain)
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

// include the preset file
module_load_include('inc', 'video', 'modules/video_ui/video.preset');

/**
 * Implementation of hook_features_export_options().
 */
function video_features_export_options() {
  $options = array();
  foreach (video_preset_get_presets () as $preset) {
    $options[$preset['name']] = $preset['name'];
  }
  return $options;
}

/**
 * Implementation of hook_features_export().
 */
function video_features_export($data, &$export, $module_name = '') {
  foreach ($data as $preset) {
    $export['features']['video'][$preset] = $preset;
  }
}

/**
 * Implementation of hook_features_export_render().
 */
function video_features_export_render($module_name, $data) {
  $items = array();
  foreach ($data as $key) {
    $preset = video_get_preset($key);
    unset($preset['pid']);
    $items[$key] = $preset;
  }
  $code = "  \$items = " . features_var_export($items, '  ') . ";\n";
  $code .= '  return $items;';
  return array('video_default_presets' => $code);
}

/**
 * Implementation of hook_features_revert().
 */
function video_features_revert($module) {
  if ($default_presets = features_get_default('video', $module)) {
    foreach (array_keys($default_presets) as $default_preset) {
      video_preset_delete($default_preset);
    }
  }
}