You are here

function media_browser_plus_main_view_javascript_settings in Media Browser Plus 7

Same name and namespace in other branches
  1. 7.2 media_browser_plus.module \media_browser_plus_main_view_javascript_settings()

Returns default javascript settings.

2 calls to media_browser_plus_main_view_javascript_settings()
media_browser_plus_form_media_admin_alter in ./media_browser_plus.module
Alter the media browser from to enable new UI
media_browser_plus_library_browser in ./media_browser_plus.module
Creates the Extended Library for the media browser popup.

File

./media_browser_plus.module, line 2010
Adds fields to the media browser forms for better UX

Code

function media_browser_plus_main_view_javascript_settings() {
  global $base_url;

  // Gather enviroment data.
  $path = drupal_get_path('module', 'media_browser_plus');
  $url = $base_url . base_path();

  // Create default settings.
  $settings = array(
    'media_browser_plus' => array(
      'filter_active' => isset($_SESSION['media-filter']),
      'url' => $url,
      'images_url' => $base_url . '/' . $path . '/images/',
      'page' => isset($_GET['page']) ? $_GET['page'] : 0,
      'per_page' => variable_get('media_media_per_page'),
      'page_items_per_page' => variable_get('media_page_items_per_page'),
      'folder_management_url' => url('admin/content/media/folder_list'),
      'multiselect' => TRUE,
      // texts
      'messages' => array(
        'only_one_selection_allowed' => t('Only one media item may be selected'),
      ),
      // access settings
      'folder_dnd_enabled' => media_access('edit'),
      'manage_folders' => media_access('edit folders'),
      'filter_allowed' => media_access('filter'),
      'add_files' => media_access('upload'),
    ),
  );
  return $settings;
}