[英]Octobercms disble fields in relation
似乎您正在尝试禁用 relation manager field
(只读)
但是我相信他们不会 same patter as normal widgets do
遵循same patter as normal widgets do
。
他们不能像我发现的其他简便方法那样直接禁用。
您可能已经使用了partial for rendering this relational field
(book | user),而您的_books.htm
部分看起来像这样。
<?= $this->relationRender('comments', ['readOnly' => false]) ?>
你需要用这个改变它
<?php if($this->widget->form->context == 'update'): ?>
<?= $this->relationRender('comments', ['readOnly' => true]) ?>
<?php else: ?>
<?= $this->relationRender('comments', ['readOnly' => false]) ?>
<?php endif; ?>
神奇的config值是这个readOnly
属性,它将使列表为read-only or active working
。
尝试此操作将起作用,否则请发表评论。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.