silverstripe-userforms/code/Modifier/UnderscoreSegmentFieldModifier.php

19 lines
449 B
PHP
Raw Normal View History

2015-08-12 08:57:19 +12:00
<?php
namespace SilverStripe\UserForms\Modifier;
2015-08-12 08:57:19 +12:00
use SilverStripe\Forms\SegmentFieldModifier\SlugSegmentFieldModifier;
2016-07-21 17:53:59 +12:00
class UnderscoreSegmentFieldModifier extends SlugSegmentFieldModifier
{
public function getPreview($value)
{
2022-04-13 13:52:56 +12:00
return str_replace('-', '_', parent::getPreview($value) ?? '');
2016-07-21 17:53:59 +12:00
}
2015-08-12 08:57:19 +12:00
2016-07-21 17:53:59 +12:00
public function getSuggestion($value)
{
2022-04-13 13:52:56 +12:00
return str_replace('-', '_', parent::getSuggestion($value) ?? '');
2016-07-21 17:53:59 +12:00
}
2015-08-12 08:57:19 +12:00
}