You are here

function kaltura_views_field_view_formatter_options in Kaltura 7.2

Same name and namespace in other branches
  1. 7.3 plugins/kaltura_views/kaltura_views_handler_field_kaltura_media.inc \kaltura_views_field_view_formatter_options()

Helper function: Return an array of formatter options for a field type.

Borrowed from field_ui.

File

plugins/kaltura_views/kaltura_views_handler_field_kaltura_media.inc, line 10

Code

function kaltura_views_field_view_formatter_options($field_type = NULL) {
  $options =& drupal_static(__FUNCTION__);
  if (!isset($options)) {
    $field_types = field_info_field_types();
    $options = array();
    foreach (field_info_formatter_types() as $name => $formatter) {
      foreach ($formatter['field types'] as $formatter_field_type) {

        // Check that the field type exists.
        if (isset($field_types[$formatter_field_type])) {
          $options[$formatter_field_type][$name] = $formatter['label'];
        }
      }
    }
  }
  if ($field_type) {
    return !empty($options[$field_type]) ? $options[$field_type] : array();
  }
  return $options;
}