You are here

public function RestfulBase::getUrl in RESTful 7

Helper method; Get the URL of the resource and query strings.

By default the URL is absolute.

Parameters

$request: The request array.

$options: Array with options passed to url().

$keep_query: If TRUE the $request will be appended to the $options['query']. This is the typical behavior for $_GET method, however it is not for $_POST. Defaults to TRUE.

Return value

string The URL address.

File

plugins/restful/RestfulBase.php, line 1215
Contains RestfulBase.

Class

RestfulBase
Class \RestfulBase

Code

public function getUrl($request = NULL, $options = array(), $keep_query = TRUE) {

  // By default set URL to be absolute.
  $options += array(
    'absolute' => TRUE,
    'query' => array(),
  );
  if ($keep_query) {

    // Remove special params.
    unset($request['q']);
    static::cleanRequest($request);

    // Add the request as query strings.
    $options['query'] += $request;
  }
  return $this
    ->versionedUrl('', $options);
}