You are here

public static function Preset::getPreset in Video 7.2

Retrieves a single preset.

4 calls to Preset::getPreset()
Preset::deletePreset in includes/Preset.inc
Deletes a preset from the database.
video_features_export_render in ./video.features.inc
Implements hook_features_export_render().
video_get_preset in modules/video_ui/video.preset.inc
Retrieves a single preset.
video_preset_load in modules/video_ui/video_ui.module
Implementing the special "auto-loader" for menu %video_preset.

File

includes/Preset.inc, line 128
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 getPreset($preset_name) {
  $preset = FALSE;

  // Check if it is a default preset.
  $default_presets = self::getDefaultPresets();
  if (isset($default_presets[$preset_name])) {
    $preset = $default_presets[$preset_name];
    $preset['overridden'] = FALSE;
  }

  // Get the preset from the database.
  $dbpreset = db_select('video_preset', 'p')
    ->fields('p')
    ->condition('p.name', $preset_name)
    ->execute()
    ->fetchAssoc();
  if ($dbpreset) {
    $dbpreset['settings'] = !empty($dbpreset['settings']) ? unserialize($dbpreset['settings']) : array();
    if ($preset == NULL) {
      $dbpreset['overridden'] = NULL;
      $dbpreset['module'] = NULL;
    }
    else {
      $dbpreset['overridden'] = TRUE;
      $dbpreset['module'] = $preset['module'];
    }
    $preset = $dbpreset;
  }

  // Return the preset.
  return $preset;
}