本文整理汇总了PHP中TextareaField::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP TextareaField::setValue方法的具体用法?PHP TextareaField::setValue怎么用?PHP TextareaField::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextareaField
的用法示例。
在下文中一共展示了TextareaField::setValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
/**
* @param IRSVP $rsvp
* @param IRSVPQuestionTemplate $question
* @param IRSVPAnswer $answer
* @return FormField
*/
public function build(IRSVP $rsvp, IRSVPQuestionTemplate $question, IRSVPAnswer $answer)
{
$field = new TextareaField($question->name(), $question->label());
$field->setValue($question->initialValue());
$field->setColumns(50);
if ($question->isReadOnly()) {
$field->setDisabled(true);
}
if ($question->isMandatory()) {
$field->setAttribute('data-rule-required', 'true');
}
if (!is_null($answer)) {
$field->setValue($answer->value());
}
return $this->buildDependantRules($rsvp, $question, $field);
}
示例2: testReadonlyDisplayUnicodes
/**
* Quick smoke test to ensure that text with unicodes is being displayed properly in readonly fields.
*/
function testReadonlyDisplayUnicodes()
{
$inputText = "These are some unicodes: äöü";
$field = new TextareaField("Test", "Test");
$field->setValue($inputText);
$field = $field->performReadonlyTransformation();
$this->assertContains('These are some unicodes: äöü', $field->Field());
}
示例3: getColumnContent
/**
* HTML for the column, content of the <td> element.
*
* @param GridField $gridField
* @param DataObject $record - Record displayed in this row
* @param string $columnName
* @return string - HTML for the column. Return NULL to skip.
*/
public function getColumnContent($gridField, $record, $columnName)
{
$field = new TextareaField('MetaDescription');
$value = $gridField->getDataFieldValue($record, $columnName);
$value = $this->formatValue($gridField, $record, $columnName, $value);
$field->setName($this->getFieldName($field->getName(), $gridField, $record));
$field->setValue($value);
return $field->Field() . $this->getErrorMessages();
}
开发者ID:helpfulrobot,项目名称:littlegiant-silverstripe-seo-editor,代码行数:17,代码来源:SEOEditorMetaDescriptionColumn.php
示例4: 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
if (isset($_REQUEST['ID'])) {
$id = addslashes($_REQUEST['ID']);
} else {
throw new Exception("invalid ID");
}
// 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 FieldList(new LabelField("Filename", "File: " . $path), $sourceTextField = new TextareaField("SourceText", ""), new HiddenField('ID', 'ID'), new HiddenField('BackURL', 'BackURL', $this->Link())), new FieldList(new FormAction('cancelFileEdit', _t('DynamicTemplate.CANCELFILEEDIT', 'Cancel'))));
$form->setTemplate('FilesEditorForm');
// Get the contents of the file
$contents = file_get_contents(BASE_PATH . $path);
$sourceTextField->setRows(20);
$sourceTextField->setColumns(150);
$sourceTextField->setValue($contents);
$form->HelpType = null;
return $form;
}
示例5: setValue
public function setValue($value)
{
// Regenerate links prior to preview, so that the editor can see them.
$value = Image::regenerate_html_links($value);
return parent::setValue($value);
}
示例6: TextField
function __construct($controller, $name, $speaker = null, $member = null, $email = null)
{
// Get the city for the current member
if ($member) {
$country = $member->Country;
} else {
$country = '';
}
// Fields
$FirstNameField = new TextField('FirstName', "Speaker's First Name");
$LastNameField = new TextField('LastName', "Speaker's Last Name");
$TitleField = new TextField('Title', "Speaker's Title");
$BioField = new TextAreaField('Bio', "Speaker's Bio");
// ID Fields
$SpeakerIDField = new HiddenField('SpeakerID', 'SpeakerID', "");
$MemberIDField = new HiddenField('MemberID', 'MemberID');
// Replace Fields
$ReplaceBioField = new HiddenField('ReplaceBio', 'ReplaceBio', 0);
$ReplaceNameField = new HiddenField('ReplaceName', 'ReplaceName', 0);
$ReplaceSurnameField = new HiddenField('ReplaceSurname', 'ReplaceSurname', 0);
// IRC and Twitter
$IRCHandleField = new TextField('IRCHandle', 'IRC Handle <em>(Optional)</em>');
$TwiiterNameField = new TextField('TwitterName', 'Twitter Name <em>(Optional)</em>');
// Upload Speaker Photo
$PhotoField = new CustomUploadField('Photo', 'Upload a speaker photo');
$PhotoField->setCanAttachExisting(false);
$PhotoField->setAllowedMaxFileNumber(1);
$PhotoField->setAllowedFileCategories('image');
$PhotoField->setTemplateFileButtons('CustomUploadField_FrontEndFIleButtons');
$PhotoField->setFolderName('profile-images');
$sizeMB = 2;
// 1 MB
$size = $sizeMB * 1024 * 1024;
// 1 MB in bytes
$PhotoField->getValidator()->setAllowedMaxFileSize($size);
$PhotoField->setCanPreviewFolder(false);
// Don't show target filesystem folder on upload field
// Opt In Field
$OptInField = new CheckboxField('AvailableForBureau', "I'd like to be in the speaker bureau.");
$Divider = new LiteralField('hr', '<hr/>');
// Funded Travel
$FundedTravelField = new CheckboxField('FundedTravel', "My Company would be willing to fund my travel to events.");
// Country Field
$CountryCodes = CountryCodes::$iso_3166_countryCodes;
$CountryField = new DropdownField('Country', 'Country', $CountryCodes);
$CountryField->setEmptyString('-- Select One --');
$CountryField->setValue($country);
$ExpertiseField = new TextareaField('Expertise', 'Topics of interest (one per line)');
// Load Existing Data if present
if ($speaker) {
$this->record = $speaker;
$FirstNameField->setValue($speaker->FirstName);
$LastNameField->setValue($speaker->LastName);
$BioField->setValue($speaker->Bio);
$SpeakerIDField->setValue($speaker->ID);
$MemberIDField->setValue($speaker->MemberID);
$TitleField->setValue($speaker->Title);
$IRCHandleField->setValue($speaker->IRCHandle);
$TwiiterNameField->setValue($speaker->TwitterName);
$OptInField->setValue($speaker->AvailableForBureau);
$FundedTravelField->setValue($speaker->FundedTravel);
$ExpertiseField->setValue($speaker->Expertise);
$PhotoField->setValue(null, $speaker);
} elseif ($member) {
$FirstNameField->setValue($member->FirstName);
$LastNameField->setValue($member->LastName);
$BioField->setValue($member->Bio);
$MemberIDField->setValue($member->ID);
$IRCHandleField->setValue($member->IRCHandle);
$TwiiterNameField->setValue($member->TwitterName);
}
$fields = new FieldList($FirstNameField, $LastNameField, $TitleField, $BioField, $SpeakerIDField, $MemberIDField, $ReplaceBioField, $ReplaceNameField, $ReplaceSurnameField, $IRCHandleField, $TwiiterNameField, $PhotoField, $Divider, $OptInField, $FundedTravelField, $CountryField, $ExpertiseField);
$actions = new FieldList(new FormAction('addAction', 'Save Speaker Details'));
$validator = new RequiredFields('FirstName', 'LastName', 'Title');
parent::__construct($controller, $name, $fields, $actions, $validator);
}
示例7: testTextEncoding
/**
* Quick smoke test to ensure that text is being encoded properly.
*/
function testTextEncoding() {
$inputText = "This is my <text>These are some unicodes: äöü&<>";
$field = new TextareaField("Test", "Test");
$field->setValue($inputText);
$this->assertContains('This is my <text>These are some unicodes: äöü&<>', $field->Field());
}