You are here

function media_library_query_alter in Media Library 7

Implements hook_query_alter().

File

./media_library.module, line 199
Restricts the media library to only designated files.

Code

function media_library_query_alter($query) {

  // Restrict the files in the file list to only those which are included in the
  // media library when on the library page .
  if (!module_exists('admin_views')) {
    if (current_path() == 'admin/content/file/library') {
      $tables = $query
        ->getTables();
      if (!empty($tables['base']['table']) && $tables['base']['table'] == 'file_managed') {
        $query
          ->condition('library', INCLUDE_IN_LIBRARY, '=');
      }
    }
  }
}