Projet

Général

Profil

Révision 2b3c8cc1

Ajouté par Assos Assos il y a presque 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/media/media.api.php
14 14
 * @return array
15 15
 *   The unique URI for the file, based on its stream wrapper, or NULL.
16 16
 *
17
 * @see hook_media_parse_alter()
17 18
 * @see media_parse_to_file()
18 19
 * @see media_add_from_url_validate()
19 20
 */
......
27 28
  }
28 29
}
29 30

  
31
/**
32
 * Alters the parsing of urls and embedded codes into unique URIs.
33
 *
34
 * @param string $success
35
 *   The unique URI for the file, based on its stream wrapper, or NULL.
36
 * @param array $context
37
 *   A nested array of contextual information containing the following keys:
38
 *   - url: The original URL or embed code to parse.
39
 *   - module: The name of the module which is attempting to parse the url or
40
 *     embedded code into a unique URI.
41
 *
42
 * @see hook_media_parse()
43
 * @see hook_media_browser_plugin_info()
44
 * @see media_get_browser_plugin_info()
45
 */
46
function hook_media_parse_alter(&$success, $context) {
47
  $url = $context['url'];
48
  $url_info = parse_url($url);
49

  
50
  // Restrict users to only embedding secure links.
51
  if ($url_info['scheme'] != 'https') {
52
    $success = NULL;
53
  }
54

  
55
  // Use a custom handler for detecting YouTube videos.
56
  if ($context['module' == 'media_youtube']) {
57
    $handler = new CustomYouTubeHandler($url);
58
    $success = $handler->parse($url);
59
  }
60
}
61

  
30 62
/**
31 63
 * Returns a list of plugins for the media browser.
32 64
 *
......
99 131
 * @see media_set_browser_params()
100 132
 */
101 133
function hook_media_browser_params_alter(&$stored_params) {
134
  $stored_params['view_mode'] = 'custom';
102 135
  $stored_params['types'][] = 'document';
103 136
  unset($stored_params['enabledPlugins'][0]);
104 137
}

Formats disponibles : Unified diff