Jump to main content Jump to doc navigation

modX::filterPathSegment

Delegates to the static modResource::filterPathSegment() — the pipeline that converts a pagetitle into a Resource alias. In order, it:

  1. strips tags and decodes entities;
  2. transliterates and restricts the character set;
  3. applies word delimiters, lowercases and trims;
  4. cuts the segment to friendly_alias_max_length when the setting is above zero.

The same method runs as the filterPathSegment output filter, and media sources pass upload names through it.

Syntax

string filterPathSegment (string $string, [array $options = []])
  • $string (string) text to convert
  • $options (array) friendly_alias_* overrides for this call, by default []

Example

$segment = $modx->filterPathSegment('My News Title');
// 'my-news-title'

$segment = $modx->filterPathSegment('My News Title', array(
    'friendly_alias_lowercase_only' => false,
));
// 'My-News-Title'

See Also

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • CrewMark
  • Fabian Christen
  • Sepia River Studios
  • Dannevang Digital
  • Alex
  • A. Moreno
  • Chris Fickling
  • Stéphane Jäggi
  • Murray Wood
  • Anton Tarasov
  • JT Skaggs
  • deJaya
  • Lefthandmedia
  • eydolan
  • Following Sea
  • Guido Gallenkamp
  • YJ
  • Raffy
  • Snow Creative
  • Nick Clark
  • Guest
  • Helen
  • krisznet
  • Yanni
  • Richard

Budget

$194 per month—let's make that $500!

Learn more