function AliasStorage::getAliasesForAdminListing

Loads aliases for admin listing.

Parameters

array $header: Table header.

string|null $keys: (optional) Search keyword that may include one or more '*' as wildcard values.

Return value

array Array of items to be displayed on the current page.

Overrides AliasStorageInterface::getAliasesForAdminListing

File

core/lib/Drupal/Core/Path/AliasStorage.php, line 306

Class

AliasStorage
Provides a class for CRUD operations on path aliases.

Namespace

Drupal\Core\Path

Code

public function getAliasesForAdminListing($header, $keys = NULL) {
  $query = $this->connection
    ->select(static::TABLE)
    ->extend('Drupal\\Core\\Database\\Query\\PagerSelectExtender')
    ->extend('Drupal\\Core\\Database\\Query\\TableSortExtender');
  if ($keys) {
    // Replace wildcards with PDO wildcards.
    $query->condition('alias', '%' . preg_replace('!\\*+!', '%', $keys) . '%', 'LIKE');
  }
  $query->addField(static::TABLE, 'id', 'pid');
  $query->addField(static::TABLE, 'path', 'source');
  return $query->fields(static::TABLE, [
    'alias',
    'langcode',
  ])
    ->orderByHeader($header)
    ->limit(50)
    ->execute()
    ->fetchAll();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.