You are here

function slick_get_media_fields in Slick Carousel 7.2

Gets a list of fields in the Media file field.

1 call to slick_get_media_fields()
_slick_fields_field_formatter_settings_form in slick_fields/includes/slick_fields.formatters.admin.inc
Off-loaded hook_field_formatter_settings_form().

File

includes/slick.admin.inc, line 377
Contains optional functions called only if needed by admin pages.

Code

function slick_get_media_fields($instance, $widget_types = NULL) {
  $options = array();
  $types = drupal_map_assoc(array(
    'audio',
    'image',
    'slideshow',
    'video',
  ));

  // Expose all media sub-fields, and merge them as available options.
  foreach ($types as $media_type) {
    $fields = field_info_instances('file', $media_type);
    foreach ($fields as $key => $media_field) {
      $type = $media_field['widget']['type'];
      if ($widget_types) {
        if (in_array($type, $widget_types)) {
          $options[$key] = $media_field['label'];
        }
      }
      else {
        $options[$key] = $media_field['label'];
      }
    }
  }
  return $options;
}