You are here

function hook_gutenberg_media_search_query_alter in Gutenberg 8

Same name and namespace in other branches
  1. 8.2 gutenberg.api.php \hook_gutenberg_media_search_query_alter()

Perform alterations to a gutenberg's media (file entity) search query.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The request.

string $type: MIME type search string.

string $search: Filename search string.

\Drupal\Core\Entity\Query\Sql\Query $query: Entity query object.

1 invocation of hook_gutenberg_media_search_query_alter()
MediaService::search in src/Service/MediaService.php
Search for file entities.

File

./gutenberg.api.php, line 25
Documentation for Gutenberg module APIs.

Code

function hook_gutenberg_media_search_query_alter(Request $request, string $type = NULL, string $search = NULL, Query $query) {
  if ($type == 'image') {
    $query
      ->condition('uri', 'public://avatars/%', 'NOT LIKE');
  }
}