You are here

function video_preset_get_presets in Video 7

Same name and namespace in other branches
  1. 7.2 modules/video_ui/video.preset.inc \video_preset_get_presets()

Gets a list of all presets.

3 calls to video_preset_get_presets()
video_features_export_options in ./video.features.inc
Implementation of hook_features_export_options().
video_preset::admin_settings in includes/preset.inc
Show admin settings
video_presets_overview in modules/video_ui/video.preset.inc
Menu callback: video Module administration.

File

modules/video_ui/video.preset.inc, line 660

Code

function video_preset_get_presets() {
  $presets = array();
  $normal_presets = array();

  // Get all the presets from the database.
  $result = db_select('video_preset', 'p')
    ->fields('p')
    ->orderBy('p.name', 'ASC')
    ->execute();

  // Iterate through all the presets and structure them in an array.
  foreach ($result as $preset) {
    $preset = (array) $preset;
    $preset['settings'] = $preset['settings'] ? unserialize($preset['settings']) : array();
    $presets[$preset['pid']] = $preset;
    $normal_presets[$preset['name']] = $preset['pid'];
  }

  // Now allow other modules to add their default presets.
  foreach (video_preset_get_default_presets() as $preset) {

    // adding default TRUE
    $preset['default'] = TRUE;
    if (!empty($preset['name']) && !isset($normal_presets[$preset['name']])) {
      $presets[$preset['name']] = $preset;
    }
  }
  return $presets;
}