function ds_panels_get_enabled_view_modes in Display Suite 7
Get enabled view modes for an entity_type and bundle.
Parameters
$entity_type: The name of the entity.
$bundle: The name of the bundle
Return value
$default A collection of enabled view modes.
1 call to ds_panels_get_enabled_view_modes()
- ds_panels_display_settings in modules/
ds_extras/ ds_extras.panels.inc - Form callback: Show custom display settings.
File
- modules/
ds_extras/ ds_extras.panels.inc, line 174 - Administrative functions for DS panels.
Code
function ds_panels_get_enabled_view_modes($entity_type, $bundle) {
$default = $options = array();
$entity_info = entity_get_info($entity_type);
$view_modes = $entity_info['view modes'];
$view_mode_settings = field_view_mode_settings($entity_type, $bundle);
foreach ($view_modes as $view_mode_name => $view_mode_info) {
$options[$view_mode_name] = $view_mode_info['label'];
if (!empty($view_mode_settings[$view_mode_name]['custom_settings'])) {
$default[] = $view_mode_name;
}
}
return array(
'options' => $options,
'default' => $default,
);
}