mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Added readonly version of SiteTreeURLSegmentFiled, small quality of life thing when a user is looking at readonly data and wants to easily view the frontend of that page.
This commit is contained in:
parent
a8d48b51b1
commit
68694c01b7
@ -133,4 +133,27 @@ class SiteTreeURLSegmentField extends TextField {
|
|||||||
return Controller::join_links($this->getURLPrefix(), $this->Value(), $this->getURLSuffix());
|
return Controller::join_links($this->getURLPrefix(), $this->Value(), $this->getURLSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function performReadonlyTransformation() {
|
||||||
|
$newInst = parent::performReadonlyTransformation();
|
||||||
|
$newInst->helpText = $this->helpText;
|
||||||
|
$newInst->urlPrefix = $this->urlPrefix;
|
||||||
|
$newInst->urlSuffix = $this->urlSuffix;
|
||||||
|
$newInst->defaultUrl = $this->defaultUrl;
|
||||||
|
return $newInst;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Readonly version of a site tree URL segment field
|
||||||
|
*
|
||||||
|
* @package forms
|
||||||
|
* @subpackage fields-basic
|
||||||
|
*/
|
||||||
|
class SiteTreeURLSegmentField_Readonly extends SiteTreeURLSegmentField {
|
||||||
|
protected $readonly = true;
|
||||||
|
|
||||||
|
public function performReadonlyTransformation() {
|
||||||
|
return clone $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,11 @@
|
|||||||
<a class="preview" href="$URL" target="_blank">
|
<a class="preview" href="$URL" target="_blank">
|
||||||
$URL
|
$URL
|
||||||
</a>
|
</a>
|
||||||
<button type="button" class="ss-ui-button ss-ui-button-small edit">
|
<% if not $IsReadonly %>
|
||||||
<% _t('URLSegmentField.Edit', 'Edit') %>
|
<button type="button" class="ss-ui-button ss-ui-button-small edit">
|
||||||
</button>
|
<% _t('URLSegmentField.Edit', 'Edit') %>
|
||||||
|
</button>
|
||||||
|
<% end_if %>
|
||||||
</div>
|
</div>
|
||||||
<div class="edit-holder">
|
<div class="edit-holder">
|
||||||
<input $AttributesHTML />
|
<input $AttributesHTML />
|
||||||
|
Loading…
Reference in New Issue
Block a user