You are here

function media_page_alter in D7 Media 7

Same name and namespace in other branches
  1. 7.4 media.module \media_page_alter()
  2. 7.2 media.module \media_page_alter()
  3. 7.3 media.module \media_page_alter()

Implements hook_page_alter().

This is used to use our alternate template when ?render=media-popup is passed in the URL.

File

./media.module, line 451
Media API

Code

function media_page_alter(&$page) {

  // Show a nagging message when the media installation needs to be completed.
  if (user_access('administer media') && media_variable_get('show_file_type_rebuild_nag') && $_SERVER['REQUEST_METHOD'] == 'GET' && path_is_admin(current_path()) && arg(0) != 'batch' && current_path() != 'admin/config/media/rebuild_types') {
    drupal_set_message(t('Media module install is not complete. <a href="@type_rebuild_link">Finish the install</a>.', array(
      '@type_rebuild_link' => url('admin/config/media/rebuild_types'),
    )), 'warning', FALSE);
  }
  if (isset($_GET['render']) && $_GET['render'] == 'media-popup') {
    $page['#theme'] = 'media_dialog_page';

    // Disable administration modules from adding output to the popup.
    // @see http://drupal.org/node/914786
    module_invoke_all('suppress');
    foreach (element_children($page) as $key) {
      if ($key != 'content') {
        unset($page[$key]);
      }
    }
  }
}