function media_set_browser_params

cis7 media.browser.inc media_set_browser_params()
cle7 media.browser.inc media_set_browser_params()
elmsmedia7 media.browser.inc media_set_browser_params()
icor7 media.browser.inc media_set_browser_params()
meedjum_blog7 media.browser.inc media_set_browser_params()
mooc7 media.browser.inc media_set_browser_params()

Provides a singleton of the params passed to the media browser.

This is useful in situations like form alters because callers can pass id="wysiywg_form" or whatever they want, and a form alter could pick this up. We may want to change the hook_media_browser_plugin_view() implementations to use this function instead of being passed params for consistency.

It also offers a chance for some meddler to meddle with them.

See also

media_browser()

2 calls to media_set_browser_params()
media_browser in sites/all/modules/ulmus/media/includes/media.browser.inc
Media browser page callback.
media_get_browser_params in sites/all/modules/ulmus/media/includes/media.browser.inc
For sanity in grammar.

File

sites/all/modules/ulmus/media/includes/media.browser.inc, line 192
Summon plugins and render the media browser.

Code

function media_set_browser_params() {
  $params = &drupal_static(__FUNCTION__, array());

  if (empty($params)) {
    // Build out browser settings. Permissions- and security-related behaviors
    // should not rely on these parameters, since they come from the HTTP query.
    // @TODO make sure we treat parameters as user input.
    $params = drupal_get_query_parameters() + array(
      'types' => array(),
      'multiselect' => FALSE,
    );

    // Transform text 'true' and 'false' to actual booleans.
    foreach ($params as $k => $v) {
      if ($v === 'true') {
        $params[$k] = TRUE;
      }
      elseif ($v === 'false') {
        $params[$k] = FALSE;
      }
    }

    array_walk_recursive($params, 'media_recursive_check_plain');

    // Allow modules to alter the parameters.
    drupal_alter('media_browser_params', $params);
  }

  return $params;
}