You are here

public function IpGeoLocGlobal::extractValue in IP Geolocation Views & Maps 8

Extracts a Views argument value from the supplied string.

Parameters

string $string: The string to parse.

array $view_args: The View arguments.

Return value

string The extracted value.

File

src/Services/IpGeoLocGlobal.php, line 455

Class

IpGeoLocGlobal
Class IpGeoLocGlobal.

Namespace

Drupal\ip_geoloc\Services

Code

public function extractValue($string, array $view_args) {
  if (preg_match('/^!([0-9])/', $string, $matches)) {
    $arg = $matches[1];
    return isset($view_args[$arg - 1]) ? $view_args[$arg - 1] : arg($arg);
  }
  return $string;
}