You are here

public function SearchByPageService::explodePathParts in Search by Page 8

Splits a path into the main path and any query parts. [D8 ported] search_by_page_path_parts() in .module file.

Parameters

$path: Path to split.

Return value

Array, first element is main path (after resolving aliases), second is query string.

File

src/Services/SearchByPageService.php, line 136
Search By Page Service and helper methods.

Class

SearchByPageService

Namespace

Drupal\search_by_page\Services

Code

public function explodePathParts($path) {

  // see if there is a ? in the path
  $path = \Drupal::service('path.alias_manager')
    ->getAliasByPath($path);
  $stuff = explode('?', $path, 2);
  if (count($stuff) > 1) {
    return $stuff;
  }

  // see if there is an & in the path
  return explode('&', $path, 2);
}