本文整理匯總了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;
}