2015-08-11 22:57:19 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use SilverStripe\Forms\SegmentFieldModifier\SlugSegmentFieldModifier;
|
|
|
|
|
2016-07-21 07:53:59 +02:00
|
|
|
class UnderscoreSegmentFieldModifier extends SlugSegmentFieldModifier
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*
|
|
|
|
* @param string $value
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getPreview($value)
|
|
|
|
{
|
|
|
|
return str_replace('-', '_', parent::getPreview($value));
|
|
|
|
}
|
2015-08-11 22:57:19 +02:00
|
|
|
|
2016-07-21 07:53:59 +02:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*
|
|
|
|
* @param string $value
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getSuggestion($value)
|
|
|
|
{
|
|
|
|
return str_replace('-', '_', parent::getSuggestion($value));
|
|
|
|
}
|
2015-08-11 22:57:19 +02:00
|
|
|
}
|