You are here

function mediafront_preset_name_exists in MediaFront 7

Same name and namespace in other branches
  1. 6.2 includes/mediafront.preset.inc \mediafront_preset_name_exists()
  2. 6 includes/mediafront.preset.inc \mediafront_preset_name_exists()
  3. 7.2 includes/mediafront.preset.inc \mediafront_preset_name_exists()

Checks to see if another preset is already taken.

1 call to mediafront_preset_name_exists()
mediafront_validate_preset_name in includes/mediafront.preset.inc
Verify the syntax of the given prefix name.

File

includes/mediafront.preset.inc, line 626

Code

function mediafront_preset_name_exists($preset_name) {

  // Get the default presets.
  $default_presets = mediafront_preset_get_default_presets();

  // See if there is a default preset name.
  if ($default_presets && isset($default_presets[$preset_name])) {
    return true;
  }
  else {
    return (bool) db_select('mediafront_preset', 'p')
      ->fields('p')
      ->condition('p.name', $preset_name)
      ->range(0, 1)
      ->execute()
      ->fetchField();
  }
}