You are here

public static function Utility::limitUnderscores in Menu Item Extras 8.2

Filter more than 2 underscores in the row.

Parameters

string $str: Input string.

Return value

null|string Filtered string.

2 calls to Utility::limitUnderscores()
Utility::sanitizeMachineName in src/Utility/Utility.php
Sanitize string.
Utility::suggestion in src/Utility/Utility.php
Suggestion builder, based on recieved args.

File

src/Utility/Utility.php, line 77

Class

Utility
Utility functions specific to menu_item_extras.

Namespace

Drupal\menu_item_extras\Utility

Code

public static function limitUnderscores($str) {
  return preg_replace('/__+/', '__', $str);
}