You are here

public function TokenArgument::cleanArgumentValue in Views Token Argument 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/views/argument_default/TokenArgument.php \Drupal\views_argument_token\Plugin\views\argument_default\TokenArgument::cleanArgumentValue()

Removes '+' or ',' at the beginning and at the end of an argument string.

@todo: evaluate if still needed.

Parameters

string $argument: Argument string to clean.

Return value

string Cleaned argument.

1 call to TokenArgument::cleanArgumentValue()
TokenArgument::getArgument in src/Plugin/views/argument_default/TokenArgument.php
Return the default argument.

File

src/Plugin/views/argument_default/TokenArgument.php, line 252

Class

TokenArgument
The Token argument default handler.

Namespace

Drupal\views_argument_token\Plugin\views\argument_default

Code

public function cleanArgumentValue($argument) {

  // Remove '+' or ',' at the beginning.
  if ($argument[0] == '+' || $argument[0] == ',') {
    $argument = substr($argument, 1);
  }

  // Remove '+' or ',' at the the end.
  if ($argument[strlen($argument) - 1] == '+' || $argument[strlen($argument) - 1] == ',') {
    $argument = substr($argument, 0, -1);
  }
  return $argument;
}