function mediafront_preset_get_presets in MediaFront 7.2
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 includes/mediafront.preset.inc \mediafront_preset_get_presets()
Gets a list of all presets.
7 calls to mediafront_preset_get_presets()
- mediafront_features_export_options in includes/
mediafront.features.inc - Implementation of hook_features_export_options().
- mediafront_field_formatter_view in includes/
mediafront.field.inc - Implements hook_field_formatter_view().
- mediafront_presets_overview in includes/
mediafront.preset.inc - Menu callback: MediaFront Module administration.
- mediafront_preset_form in includes/
mediafront.preset.inc - mediafront_preset_select_form in ./
mediafront.module - Define the preset form selection.
File
- includes/
mediafront.preset.inc, line 582
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;
}