public function TocFormatterInterface::convertStringToId in TOC API 8
Convert a string to a valid HTML id.
Notes: At some point, D8 core or contrib (ie Drupal\pathauto\AliasCleaner) will provide a service to slugify strings based on predefined options.
Inspired by:
- PHP function to make slug (URL string) http://stackoverflow.com/questions/2955251
- Replacing accents with their counterparts http://stackoverflow.com/questions/3230012
Parameters
string $text: String to be converted to a valid HTML id.
Return value
string A valid HTML id.
1 method overrides TocFormatterInterface::convertStringToId()
- TocFormatter::convertStringToId in src/
TocFormatter.php - Convert a string to a valid HTML id.
File
- src/
TocFormatterInterface.php, line 29
Class
- TocFormatterInterface
- Provides an interface defining a TOC formatter.
Namespace
Drupal\toc_apiCode
public function convertStringToId($text);