protected $_columnViewNamespace = 'crud::columns';
protected $_searchLogic = 'text';
+ protected $_readOnly = false;
protected $_databaseType = 'text';
protected $_databaseUnique = false;
protected $_databaseIndex = false;
{
return [
'type' => $this->_adminType, 'view_namespace' => $this->_viewNamespace, 'column' => false, 'form' => 'both', 'rules' => '',
+ 'read_only' => $this->_readOnly,
'prefix' => $this->_prefix, 'suffix' => $this->_suffix,
'fillable' => true, 'guarded' => false, 'hidden' => false,
'filter' => false, 'filter_type' => $this->_filterType, 'filter_label' => null, 'filter_values' => $this->_filterValues,
public function getDefinition()
{
$this->_preGetDefinition();
- return $this->_attributes;
+ $res = $this->_attributes;
+ if ($this->getAttribute('read_only', false)) {
+ $res['view_namespace'] = CubistBackpackServiceProvider::NAMESPACE . '::fields';
+ $res['type'] = 'static_value';
+ }
+ return $res;
}
protected function _preGetDefinition()
$default = $this->getAttribute('database_default') ?? $this->getAttribute('default');
if ($default !== null) {
- $attributes['default']=$default;
+ $attributes['default'] = $default;
}
$table->addColumn($name,