You are here

public static function Preset::getAllPresets in Video 7.2

Gets a list of all presets.

5 calls to Preset::getAllPresets()
Preset::getEnabledPresets in includes/Preset.inc
video_features_export_options in ./video.features.inc
Implements hook_features_export_options().
video_field_settings_form in ./video.field.inc
Implements hook_field_settings_form().
video_preset_admin_settings in modules/video_ui/video.admin.inc
Video preset admin settings
video_preset_get_presets in modules/video_ui/video.preset.inc
Gets a list of all presets.

File

includes/Preset.inc, line 88
Class file used to store video presets on the video.

Class

Preset
@file Class file used to store video presets on the video.

Code

public static function getAllPresets() {
  $presets = array();

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

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

  // Now allow other modules to add their default presets.
  foreach (self::getDefaultPresets() as $preset) {
    if (empty($preset['name'])) {
      continue;
    }

    // Check if this default preset has been overridden.
    if (isset($presets[$preset['name']])) {
      $presets[$preset['name']]['overridden'] = TRUE;
      $presets[$preset['name']]['module'] = $preset['module'];
    }
    else {
      $preset['overridden'] = FALSE;
      $presets[$preset['name']] = $preset;
    }
  }
  uksort($presets, 'strnatcasecmp');
  return $presets;
}