Skip to content

URL API

URLService enables you to find, load and update external URLs used in RichText and URL Fields.

To view a list of all URLs, use URLService::findUrls

URLService::findUrls takes as argument a URLQuery, in which you need to specify:

  • query filter e.g. Section
  • Sort Clauses for URL queries
  • offset for search hits, used for paging the results
  • query limit. If value is 0, search query will not return any search hits
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
// ...
use Ibexa\Contracts\Core\Repository\Values\URL\Query\Criterion;
use Ibexa\Contracts\Core\Repository\Values\URL\Query\SortClause;
use Ibexa\Contracts\Core\Repository\Values\URL\URLQuery;

// ...
        $query = new URLQuery();

        $query->filter = new Criterion\LogicalAnd(
            [
                new Criterion\SectionIdentifier(['standard']),
                new Criterion\Validity(true),
            ]
        );
        $query->sortClauses = [
            new SortClause\URL(SortClause::SORT_DESC),
        ];
        $query->offset = 0;
        $query->limit = 25;

        $results = $this->urlService->findUrls($query);

URL search reference

For the reference of Search Criteria and Sort Clauses you can use in URL search, see URL Search Criteria and URL Sort Clauses.