You are here

public function AliasCleanerInterface::cleanString in Pathauto 8

Clean up a string segment to be used in an URL alias.

Performs the following possible alterations:

  • Remove all HTML tags.
  • Process the string through the transliteration module.
  • Replace or remove punctuation with the separator character.
  • Remove back-slashes.
  • Replace non-ascii and non-numeric characters with the separator.
  • Remove common words.
  • Replace whitespace with the separator character.
  • Trim duplicate, leading, and trailing separators.
  • Convert to lower-case.
  • Shorten to a desired length and logical position based on word boundaries.

This function should *not* be called on URL alias or path strings because it is assumed that they are already clean.

Parameters

string $string: A string to clean.

array $options: (optional) A keyed array of settings and flags to control the Pathauto clean string replacement process. Supported options are:

  • langcode: A language code to be used when translating strings.

Return value

string The cleaned string.

1 method overrides AliasCleanerInterface::cleanString()
AliasCleaner::cleanString in src/AliasCleaner.php
Clean up a string segment to be used in an URL alias.

File

src/AliasCleanerInterface.php, line 70

Class

AliasCleanerInterface
@todo add class comment.

Namespace

Drupal\pathauto

Code

public function cleanString($string, array $options = []);