2015-08-12 08:57:19 +12:00
|
|
|
<?php
|
|
|
|
|
2017-08-09 11:55:09 +12:00
|
|
|
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
|
|
|
}
|