本文整理匯總了PHP中FieldSet::insertAfter方法的典型用法代碼示例。如果您正苦於以下問題:PHP FieldSet::insertAfter方法的具體用法?PHP FieldSet::insertAfter怎麽用?PHP FieldSet::insertAfter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FieldSet
的用法示例。
在下文中一共展示了FieldSet::insertAfter方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testInsertAfterWithNestedTabsets
/**
* @todo check actual placement of fields
*/
function testInsertAfterWithNestedTabsets()
{
$fieldSetA = new FieldSet($tabSetA = new TabSet('TabSet_A', $tabA1 = new Tab('Tab_A1', new TextField('A_pre'), new TextField('A'), new TextField('A_post')), $tabB1 = new Tab('Tab_B1', new TextField('B'))));
$tabSetA->insertAfter($A_insertafter = new TextField('A_insertafter'), 'A');
$this->assertEquals($fieldSetA->dataFieldByName('A_insertafter'), $A_insertafter, 'Field on toplevel tab can be inserted after');
$this->assertEquals(0, $tabA1->fieldPosition('A_pre'));
$this->assertEquals(1, $tabA1->fieldPosition('A'));
$this->assertEquals(2, $tabA1->fieldPosition('A_insertafter'));
$this->assertEquals(3, $tabA1->fieldPosition('A_post'));
$fieldSetB = new FieldSet(new TabSet('TabSet_A', $tabsetB = new TabSet('TabSet_B', $tabB1 = new Tab('Tab_B1', new TextField('C')), $tabB2 = new Tab('Tab_B2', new TextField('B_pre'), new TextField('B'), new TextField('B_post')))));
$fieldSetB->insertAfter($B_insertafter = new TextField('B_insertafter'), 'B');
$this->assertSame($fieldSetB->dataFieldByName('B_insertafter'), $B_insertafter, 'Field on nested tab can be inserted after');
$this->assertEquals(0, $tabB2->fieldPosition('B_pre'));
$this->assertEquals(1, $tabB2->fieldPosition('B'));
$this->assertEquals(2, $tabB2->fieldPosition('B_insertafter'));
$this->assertEquals(3, $tabB2->fieldPosition('B_post'));
}
示例2: getForumFields
/**
* Get the fields needed by the forum module
*
* @param bool $showIdentityURL Should a field for an OpenID or an i-name
* be shown (always read-only)?
* @return FieldSet Returns a FieldSet containing all needed fields for
* the registration of new users
*/
function getForumFields($showIdentityURL = false, $addmode = false)
{
$gravatarText = DataObject::get_one("ForumHolder", "\"AllowGravatars\" = 1") ? '<small>' . _t('ForumRole.CANGRAVATAR', 'If you use Gravatars then leave this blank') . '</small>' : "";
$personalDetailsFields = new CompositeField(new HeaderField("PersonalDetails", _t('ForumRole.PERSONAL', 'Personal Details')), new LiteralField("Blurb", "<p id=\"helpful\">" . _t('ForumRole.TICK', 'Tick the fields to show in public profile') . "</p>"), new TextField("Nickname", _t('ForumRole.NICKNAME', 'Nickname')), new CheckableOption("FirstNamePublic", new TextField("FirstName", _t('ForumRole.FIRSTNAME', 'First name'))), new CheckableOption("SurnamePublic", new TextField("Surname", _t('ForumRole.SURNAME', 'Surname'))), new CheckableOption("OccupationPublic", new TextField("Occupation", _t('ForumRole.OCCUPATION', 'Occupation')), true), new CheckableOption('CompanyPublic', new TextField('Company', _t('ForumRole.COMPANY', 'Company')), true), new CheckableOption('CityPublic', new TextField('City', _t('ForumRole.CITY', 'City')), true), new CheckableOption("CountryPublic", new CountryDropdownField("Country", _t('ForumRole.COUNTRY', 'Country')), true), new CheckableOption("EmailPublic", new EmailField("Email", _t('ForumRole.EMAIL', 'Email'))), new ConfirmedPasswordField("Password", _t('ForumRole.PASSWORD', 'Password')), new SimpleImageField("Avatar", _t('ForumRole.AVATAR', 'Upload avatar ') . ' ' . $gravatarText), new ReadonlyField("ForumRank", _t('ForumRole.RATING', 'User rating')));
$personalDetailsFields->setID('PersonalDetailsFields');
$fieldset = new FieldSet($personalDetailsFields);
if ($showIdentityURL) {
$fieldset->insertBefore(new ReadonlyField('IdentityURL', _t('ForumRole.OPENIDINAME', 'OpenID/i-name')), 'Password');
$fieldset->insertAfter(new LiteralField('PasswordOptionalMessage', '<p>' . _t('ForumRole.PASSOPTMESSAGE', 'Since you provided an OpenID respectively an i-name the password is optional. If you enter one, you will be able to log in also with your e-mail address.') . '</p>'), 'IdentityURL');
}
$this->owner->extend('updateForumFields', $fieldset);
return $fieldset;
}
示例3: updateCMSFields
/**
* standard SS method
*
*/
function updateCMSFields(FieldSet &$fields)
{
// is it a product or variation
if ($this->owner instanceof SiteTree) {
if (!$this->owner->Variations()->exists()) {
$tabName = "Root.Content.Main";
$fieldName = "Weight";
$fields->addFieldToTab($tabName, new NumericField('SpecialPrice', 'Special Price (0.00 will be ignored)', '', 12), $fieldName);
$fields->addFieldToTab($tabName, new NumericField('Discount', 'Percentage Discount', '', 2), $fieldName);
}
} else {
// it's a variation and hopefully has fields
$fields->insertAfter(new NumericField('SpecialPrice', 'Special Price (0.00 will be ignored)', '', 12), "Price");
$fields->insertAfter(new NumericField('Discount', 'Percentage Discount', '', 2), "SpecialPrice");
}
}
示例4: insertAfter
public function insertAfter($field, $insertAfter)
{
$ret = $this->children->insertAfter($field, $insertAfter);
$this->sequentialSet = null;
return $ret;
}
示例5: getCMSFields_forPopup
/**
* Return the fields to edit this email.
* @return FieldSet
*/
public function getCMSFields_forPopup()
{
$fields = new FieldSet(new TextField('EmailSubject', _t('UserDefinedForm.EMAILSUBJECT', 'Email Subject')), new TextField('EmailFrom', _t('UserDefinedForm.FROMADDRESS', 'Send Email From')), new TextField('EmailAddress', _t('UserDefinedForm.SENDEMAILTO', 'Send Email To')), new CheckboxField('HideFormData', _t('UserDefinedForm.HIDEFORMDATA', 'Hide Form Data from Email')), new CheckboxField('SendPlain', _t('UserDefinedForm.SENDPLAIN', 'Send Email as Plain Text (HTML will be stripped)')), new TextareaField('EmailBody', 'Body'));
if ($this->Form()) {
$validEmailFields = DataObject::get("EditableEmailField", "\"ParentID\" = '{$this->FormID}'");
$multiOptionFields = DataObject::get("EditableMultipleOptionField", "\"ParentID\" = '{$this->FormID}'");
// if they have email fields then we could send from it
if ($validEmailFields) {
$fields->insertAfter(new DropdownField('SendEmailFromFieldID', _t('UserDefinedForm.ORSELECTAFIELDTOUSEASFROM', '.. or Select a Form Field to use as the From Address'), $validEmailFields->toDropdownMap('ID', 'Title'), '', null, ""), 'EmailFrom');
}
// if they have multiple options
if ($multiOptionFields || $validEmailFields) {
if ($multiOptionFields && $validEmailFields) {
$multiOptionFields->merge($validEmailFields);
} elseif (!$multiOptionFields) {
$multiOptionFields = $validEmailFields;
}
$multiOptionFields = $multiOptionFields->toDropdownMap('ID', 'Title');
$fields->insertAfter(new DropdownField('SendEmailToFieldID', _t('UserDefinedForm.ORSELECTAFIELDTOUSEASTO', '.. or Select a Field to use as the To Address'), $multiOptionFields, '', null, ""), 'EmailAddress');
}
}
return $fields;
}