You are here

function _videojs_settings_thumbnail_fields in Video.js (HTML5 Video Player) 6.2

Same name and namespace in other branches
  1. 6 includes/videojs.admin.inc \_videojs_settings_thumbnail_fields()

Generate list of content types with filefield widget set to 'videojs'

Return value

Returns array in format [node_type]=>array( 'description', 'video_js_field', filefields=>array('filefield'=>'filefield description'))

1 call to _videojs_settings_thumbnail_fields()
videojs_settings_form in includes/videojs.admin.inc
Menu callback; Provides the Video.js settings form.

File

includes/videojs.admin.inc, line 132
Administrative pages for the Video.js module.

Code

function _videojs_settings_thumbnail_fields() {
  $video_js_node_types = array();

  // Iterate through all node_types
  foreach (array_map('check_plain', node_get_types('names')) as $node_type => $description) {

    // Iterate through all filefield field types in the current node type
    foreach (filefield_get_field_list($node_type) as $field) {

      // If widget format of the field is 'videojs' - generate structure containing node_type, videojs field name and list of possible options for thumbnails
      if ($field['display_settings']['full']['format'] == 'videojs') {
        $video_js_node_types[$node_type] = array(
          'node_type' => $field['type_name'],
          'description' => $description,
          'video_js_field' => $field['field_name'],
          'filefields' => array(),
        );

        // Get all filefield type fields except 'videojs' field (should we check only compatible extentions allowed in some widgets?)
        foreach (filefield_get_field_list($node_type) as $thumbnail_field) {
          if ($thumbnail_field['display_settings']['full']['format'] != 'videojs') {
            $video_js_node_types[$node_type]['filefields'][$thumbnail_field['field_name']] = t($thumbnail_field['field_name']);
          }
        }
      }
    }
  }
  return $video_js_node_types;
}