mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
8dd644d25d
Namespace all templates Move difflib and BBCodeParser2 to thirdparty Remove deprecated API marked for removal in 4.0
30 lines
599 B
PHP
30 lines
599 B
PHP
<?php
|
|
|
|
namespace SilverStripe\Forms;
|
|
|
|
class TreeDropdownField_Readonly extends TreeDropdownField
|
|
{
|
|
protected $readonly = true;
|
|
|
|
public function Field($properties = array())
|
|
{
|
|
$fieldName = $this->labelField;
|
|
if ($this->value) {
|
|
$keyObj = $this->objectForKey($this->value);
|
|
$obj = $keyObj ? $keyObj->$fieldName : '';
|
|
} else {
|
|
$obj = null;
|
|
}
|
|
|
|
$source = array(
|
|
$this->value => $obj
|
|
);
|
|
|
|
$field = new LookupField($this->name, $this->title, $source);
|
|
$field->setValue($this->value);
|
|
$field->setForm($this->form);
|
|
$field->dontEscape = true;
|
|
return $field->Field();
|
|
}
|
|
}
|