Mercurial > hg > isophonics-drupal-site
annotate modules/contrib/views_slideshow/src/FormatAddonsName.php @ 5:c69a71b4f40f
Add slideshow module
author | Chris Cannam |
---|---|
date | Thu, 07 Dec 2017 14:46:23 +0000 |
parents | |
children |
rev | line source |
---|---|
Chris@5 | 1 <?php |
Chris@5 | 2 |
Chris@5 | 3 namespace Drupal\views_slideshow; |
Chris@5 | 4 |
Chris@5 | 5 /** |
Chris@5 | 6 * Provides a class to manipulate addons names. |
Chris@5 | 7 */ |
Chris@5 | 8 class FormatAddonsName implements FormatAddonsNameInterface { |
Chris@5 | 9 |
Chris@5 | 10 /** |
Chris@5 | 11 * Format callback to move from underscore separated words to camelCase. |
Chris@5 | 12 */ |
Chris@5 | 13 public function format($subject) { |
Chris@5 | 14 return preg_replace_callback('/_(.?)/', function ($matches) { |
Chris@5 | 15 if (isset($matches[1])) { |
Chris@5 | 16 return strtoupper($matches[1]); |
Chris@5 | 17 } |
Chris@5 | 18 }, $subject); |
Chris@5 | 19 } |
Chris@5 | 20 |
Chris@5 | 21 } |