aboutsummaryrefslogtreecommitdiff
path: root/video.features.inc
diff options
context:
space:
mode:
authorHeshan <heshan@heidisoft.com>2011-03-07 14:40:10 +0530
committerHeshan <heshan@heidisoft.com>2011-03-07 14:40:10 +0530
commitf804c5913e46299bc52f97ce7905bc00c162db81 (patch)
tree9c887491b2e99ebd3ba013d2712fc2d927efc2bb /video.features.inc
parent7235ebc06e881ebefe1d2c45a3b0f5304e26b936 (diff)
downloadvideo-f804c5913e46299bc52f97ce7905bc00c162db81.tar.gz
video-f804c5913e46299bc52f97ce7905bc00c162db81.tar.bz2
Creating new module Video UI to manage Video module configurations ie. Preset management
Diffstat (limited to 'video.features.inc')
-rw-r--r--video.features.inc50
1 files changed, 50 insertions, 0 deletions
diff --git a/video.features.inc b/video.features.inc
new file mode 100644
index 0000000..10fbc9d
--- /dev/null
+++ b/video.features.inc
@@ -0,0 +1,50 @@
+<?php
+
+// include the preset file
+module_load_include('inc', 'video', 'includes/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);
+ }
+ }
+}