Skip to content
Snippets Groups Projects

Issue #3280023 Added "Lowercase plugin" and unit test.

Merged Sonny Kieu requested to merge issue/token_modifier-3280023:3280023-lowercase_plugin into 2.0.x
2 files
+ 62
0
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 25
0
<?php
namespace Drupal\token_modifier\Plugin\token_modifier;
use Drupal\token_modifier\Plugin\TokenModifierPluginBase;
/**
* Makes all characters of the token lowercase.
*
* @TokenModifier(
* id = "lowercase",
* name = @Translation("Lowercase"),
* description = @Translation("Lowercase the returned string.")
* )
*/
class Lowercase extends TokenModifierPluginBase {
/**
* {@inheritdoc}
*/
public function transform(string $text, array $data = [], array $options = []) {
return strtolower($this->token->replace($text, $data, $options));
}
}
Loading