You are here

function panopoly_widgets_get_required_file_fields in Panopoly Widgets 7

Gets a list of all the required file fields for the given bundle.

1 call to panopoly_widgets_get_required_file_fields()
panopoly_widgets_fieldable_panels_pane_render in ./panopoly_widgets.module
Render callback for fieldable panels panes.

File

./panopoly_widgets.module, line 175

Code

function panopoly_widgets_get_required_file_fields($bundle) {
  $required_file_fields = array();
  $field_instances = field_info_instances('fieldable_panels_pane', $bundle);
  foreach ($field_instances as $field_name => $field_instance) {
    $field_info = field_info_field($field_name);
    if (in_array($field_info['type'], array(
      'file',
      'image',
    )) && !empty($field_instance['required'])) {
      $required_file_fields[] = $field_name;
    }
  }
  return $required_file_fields;
}