# filebird/5.3.2/includes/Support/DocumentGallery.php

FileBird – WordPress Media Library Folders &amp; File Manager, version 5.3.2. 35 lines.

- Page: https://pluginprobe.com/plugins/filebird/5.3.2/code/includes/Support/DocumentGallery.php
- Raw: https://pluginprobe.com/plugins/filebird/5.3.2/raw/includes/Support/DocumentGallery.php
- Modified: 2023-06-27T08:08:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/filebird/5.3.2/code/includes/Support/DocumentGallery.php#L10-L20`.

```php
<?php

namespace FileBird\Support;

defined( 'ABSPATH' ) || exit;

use FileBird\Model\Folder as FolderModel;

class DocumentGallery {
	public function __construct() {
		add_action( 'init', array( $this, 'init' ) );
	}

	public function init() {
		if ( ! defined( 'DG_VERSION' ) || version_compare( DG_VERSION, '4.3.2', '<=' ) ) {
			return;
		}
		add_action( 'dg_query', array( $this, 'dg_query' ), 10, 4 );
	}

	public function dg_query( &$query, $taxa, &$excluded_keys, &$errs ) {
		if ( ! empty( $taxa['fbv'] ) ) {
			$excluded_keys[] = 'fbv';

			if ( is_null( FolderModel::findById( $taxa['fbv'] ) ) ) {
				$errs[] = __( 'This folder ID does not exist, please check again.', 'filebird' );
				return;
			}

			$query['fbv']              = $taxa['fbv'];
			$query['suppress_filters'] = false;
		}
	}
}

```
