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