You are here

public function Redirect::setSource in Redirect 8

Sets the source URL data.

Parameters

string $path: The base url of the source.

array $query: Query arguments.

File

src/Entity/Redirect.php, line 151

Class

Redirect
The redirect entity class.

Namespace

Drupal\redirect\Entity

Code

public function setSource($path, array $query = []) {
  $this->redirect_source
    ->set(0, [
    'path' => ltrim($path, '/'),
    'query' => $query,
  ]);
}