function panopoly_magic_view_mode_options in Panopoly 7
Helper function to get view modes
Parameters
(optional) string $entity_type: The type of entity for which to load view modes.
2 calls to panopoly_magic_view_mode_options()
- panopoly_magic_form_fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form_alter in modules/
panopoly/ panopoly_magic/ panopoly_magic.module - Implementation of hook_form_FORM_ID_alter()
- panopoly_magic_form_views_content_views_panes_content_type_edit_form_alter in modules/
panopoly/ panopoly_magic/ panopoly_magic.module - Implementation of hook_form_FORM_ID_alter()
File
- modules/
panopoly/ panopoly_magic/ panopoly_magic.module, line 1972
Code
function panopoly_magic_view_mode_options($entity_type = 'node') {
$entity_info = entity_get_info($entity_type);
$hidden_view_modes = array_filter(array_map('trim', explode("\n", variable_get('panopoly_magic_hidden_view_mode_options', PANOPOLY_MAGIC_HIDDEN_VIEW_MODE_OPTIONS))));
$options = array();
if (!empty($entity_info['view modes'])) {
foreach ($entity_info['view modes'] as $mode => $settings) {
if (!in_array($mode, $hidden_view_modes)) {
$options[$mode] = $settings['label'];
}
}
}
return $options;
}