function mediafront_preset_get_presets in MediaFront 7
Same name and namespace in other branches
- 6.2 includes/mediafront.preset.inc \mediafront_preset_get_presets()
- 6 includes/mediafront.preset.inc \mediafront_preset_get_presets()
- 7.2 includes/mediafront.preset.inc \mediafront_preset_get_presets()
Gets a list of all presets.
8 calls to mediafront_preset_get_presets()
- mediafront_features_export_options in includes/
mediafront.features.inc - Implementation of hook_features_export_options().
- mediafront_field_formatter_info in includes/
mediafront.field.inc - Implements hook_field_formatter_info().
- mediafront_field_info in includes/
mediafront.field.inc - Implements hook_field_info().
- mediafront_presets_overview in includes/
mediafront.preset.inc - Menu callback: MediaFront Module administration.
- mediafront_preset_form in includes/
mediafront.preset.inc
File
- includes/
mediafront.preset.inc, line 543
Code
function mediafront_preset_get_presets() {
$presets = array();
$normal_presets = array();
// Get all the presets from the database.
$result = db_select('mediafront_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['connect'] = $preset['connect'] ? unserialize($preset['connect']) : array();
$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 (mediafront_preset_get_default_presets() as $preset) {
if (!empty($preset['name']) && !isset($normal_presets[$preset['name']])) {
$presets[$preset['name']] = $preset;
}
}
return $presets;
}