diff options
author | Heshan <heshan@heidisoft.com> | 2011-03-04 23:20:28 +0530 |
---|---|---|
committer | Heshan <heshan@heidisoft.com> | 2011-03-04 23:20:28 +0530 |
commit | 72f7b7109d1cdf3ec1f5fb022170dedc8c9dc5e1 (patch) | |
tree | 4df43cb8b1a5371f792ca5bf657fdf0c4de32cf6 /includes/video.features.inc | |
parent | 554508a1df489a8634e876ada1fa3ddd66375f7a (diff) | |
download | video-72f7b7109d1cdf3ec1f5fb022170dedc8c9dc5e1.tar.gz video-72f7b7109d1cdf3ec1f5fb022170dedc8c9dc5e1.tar.bz2 |
Creating presets which can be exported with features, chostools and move subsidary module to modules directory
Diffstat (limited to 'includes/video.features.inc')
-rw-r--r-- | includes/video.features.inc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/includes/video.features.inc b/includes/video.features.inc new file mode 100644 index 0000000..10fbc9d --- /dev/null +++ b/includes/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); + } + } +} |