mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #1426 from SilbinaryWolf/created-readonly-sitetreeurlsegmentfield
NEW: Added readonly version of SiteTreeURLSegmentField
This commit is contained in:
commit
e4a198401a
@ -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