本文整理汇总了PHP中TextareaField::setReadonly方法的典型用法代码示例。如果您正苦于以下问题:PHP TextareaField::setReadonly方法的具体用法?PHP TextareaField::setReadonly怎么用?PHP TextareaField::setReadonly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextareaField
的用法示例。
在下文中一共展示了TextareaField::setReadonly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LinkedFileViewForm
/**
* Return the linked file view form, which shows a readonly form that contains the
* source text of the file being viewed.
* @throws Exception
* @return Form
*/
public function LinkedFileViewForm()
{
// grab the parameters
$id = $this->urlParams['ID'];
if (!$id) {
throw new Exception("Invalid path");
}
// Extract parameters from this ID. It's base 64 of
// templateID:path
$id = base64_decode($id);
$params = explode(':', $id);
if (count($params) != 2) {
throw Exception("Invalid params, expected 2 components");
}
$dynamicTemplateId = $params[0];
$path = $params[1];
$form = new Form($this, "LinkedFileViewForm", new FieldSet(new LabelField("Filename", "File: " . $path), $sourceTextField = new TextareaField("SourceText", "", 20, 100), new HiddenField('ID', 'ID'), new HiddenField('BackURL', 'BackURL', $this->Link())), new FieldSet(new FormAction('cancelFileEdit', _t('DynamicTemplate.CANCELFILEEDIT', 'Cancel'))));
$form->setTemplate('FilesEditorForm');
// Get the contents of the file
$contents = file_get_contents(BASE_PATH . $path);
$sourceTextField->setValue($contents);
$sourceTextField->setReadonly(true);
$form->HelpType = null;
return $form;
}