本文整理汇总了PHP中FieldList::insertBefore方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldList::insertBefore方法的具体用法?PHP FieldList::insertBefore怎么用?PHP FieldList::insertBefore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldList
的用法示例。
在下文中一共展示了FieldList::insertBefore方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateSettingsFields
/**
* Updates the CMS fields adding the fields defined in this extension
* @param {FieldList} $fields Field List that new fields will be added to
*/
public function updateSettingsFields(FieldList $fields)
{
$kapostRefID = $this->owner->KapostRefID;
if (!empty($kapostRefID)) {
if (CMSPageSettingsController::has_extension('KapostPageSettingsControllerExtension')) {
$messageContent = _t('KapostSiteTreeExtension.KAPOST_CONTENT_WARNING_RO', '_This Page\'s content is being populated by Kapost, some fields are not editable.');
} else {
$messageContent = _t('KapostSiteTreeExtension.KAPOST_CONTENT_WARNING', '_This Page\'s content is being populated by Kapost.');
}
//Edit in kapost link
$kapostBase = KapostAdmin::config()->kapost_base_url;
if (!empty($kapostBase)) {
$messageContent .= ' <a href="' . Controller::join_links($kapostBase, 'posts', $kapostRefID) . '" target="_blank">' . _t('KapostSiteTreeExtension.KAPOST_CONTENT_EDIT_LABEL', '_Click here to edit in Kapost') . '</a>';
}
$fields->insertBefore(new LiteralField('KapostContentWarning', '<div class="message warning">' . $messageContent . '</div>'), 'ClassName');
//Detect Incoming Changes
if (Permission::check('CMS_ACCESS_KapostAdmin')) {
$incoming = KapostObject::get()->filter('KapostRefID', Convert::raw2sql($kapostRefID));
if ($incoming->count() >= 1) {
$link = Controller::join_links(AdminRootController::config()->url_base, KapostAdmin::config()->url_segment, 'KapostObject/EditForm/field/KapostObject/item', $incoming->first()->ID, 'edit');
$messageContent = _t('KapostSiteTreeExtension.KAPOST_INCOMING', '_There are incoming changes from Kapost waiting for this page.') . ' ' . '<a href="' . $link . '" class="cms-panel-link">' . _t('KapostSiteTreeExtension.KAPOST_INCOMING_VIEW', '_Click here to view the changes') . '</a>';
$fields->insertBefore(new LiteralField('KapostIncomingWarning', '<div class="message warning">' . $messageContent . '</div>'), 'ClassName');
}
}
}
}
示例2: getEditForm
/**
* Gets the form used for viewing a time log
*/
public function getEditForm($id = null, $fields = null)
{
$record = $this->currentPage();
if ($this->action == 'view' && $record) {
$fields = new FieldList(new HeaderField('LogHeader', _t('KapostBridgeLogViewer.VIEWING_ENTRY', '_Viewing Log Entry: {datetime}', array('datetime' => $record->dbObject('Created')->FormatFromSettings())), 3), new ReadonlyField('UserAgent', _t('KapostBridgeLogViewer.USER_AGENT', '_Requestor User Agent')), new ReadonlyField('Method', _t('KapostBridgeLogViewer.METHOD', '_Method')), ToggleCompositeField::create('RequestData', _t('KapostBridgeLogViewer.KAPOST_REQUEST', '_Kapost Request'), new FieldList(ReadonlyField::create('RequestFormatted', '')->setTemplate('KapostBridgeLogField')->addExtraClass('log-contents cms-panel-layout')))->setHeadingLevel(3), ToggleCompositeField::create('ResponseData', _t('KapostBridgeLogViewer.SILVERSTRIPE_RESPONSE', '_SilverStripe Response'), new FieldList(ReadonlyField::create('ResponseFormatted', '')->setTemplate('KapostBridgeLogField')->addExtraClass('log-contents cms-panel-layout')))->setHeadingLevel(3));
$refObj = $record->ReferenceObject;
if (!empty($refObj) && $refObj !== false && $refObj->exists()) {
if (method_exists($refObj, 'CMSEditLink')) {
$fields->insertBefore(new KapostLogLinkField('CMSEditLink', _t('KapostBridgeLogViewer.REFERENCED_OBJECT', '_Referenced Object'), $refObj->CMSEditLink(), _t('KapostBridgeLogViewer.VIEW_REFERENCED_OBJECT', '_View Referenced Object')), 'RequestData');
} else {
if ($refObj instanceof File) {
$refObjLink = Controller::join_links(LeftAndMain::config()->url_base, AssetAdmin::config()->url_segment, 'EditForm/field/File/item', $refObj->ID, 'edit');
$fields->insertBefore(new KapostLogLinkField('CMSEditLink', _t('KapostBridgeLogViewer.REFERENCED_OBJECT', '_Referenced Object'), $refObjLink, _t('KapostBridgeLogViewer.VIEW_REFERENCED_OBJECT', '_View Referenced Object')), 'RequestData');
}
}
}
} else {
$fields = new FieldList();
}
$form = new CMSForm($this, 'EditForm', $fields, new FieldList());
$form->setResponseNegotiator($this->getResponseNegotiator());
$form->addExtraClass('cms-edit-form center');
$form->setAttribute('data-layout-type', 'border');
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
$form->setAttribute('data-pjax-fragment', 'CurrentForm');
$form->setHTMLID('Form_EditForm');
if ($record) {
$form->loadDataFrom($record);
}
return $form;
}
开发者ID:webbuilders-group,项目名称:silverstripe-kapost-bridge-logger,代码行数:34,代码来源:KapostBridgeLogViewer.php
示例3: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
Requirements::javascript('silverstripe-video-embed/assests/javascript/PhotoItemExtension.js');
$typeField = new DropdownField('Type', 'Type', singleton('PhotoItem')->dbObject('Type')->enumValues());
$fields->insertBefore($typeField, 'Photo');
$videoField = new DropdownField("VideoItemID", "Video", VideoEmbed::get()->map("ID", "Title"));
$fields->insertBefore($videoField, 'Caption');
}
示例4: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
/** @var FormField $idField */
$fields->removeByName('ShippableID');
// TODO make this more friendly for multiple extended classes
$shippables = Product::get()->map()->toArray();
$fields->insertBefore(new Select2Field('ShippableID', 'Shippable', $shippables, $this->owner->ShippableID), 'Price');
$regions = Region_Shipping::get()->map()->toArray();
$fields->insertBefore(new Select2Field('RegionID', 'Region', $regions, $this->owner->RegionID), 'Price');
}
示例5: updateMemberProfileCMSFields
/**
* Hook updateMemberProfileCMSFields to make sure the new fields only show on the Email proffile field.
* @param FieldList $fields
*/
public function updateMemberProfileCMSFields(FieldList $fields)
{
// If this is the Email Profile Field
if ($this->getOwner()->MemberField == 'Email') {
// Add a header
$fields->insertBefore(HeaderField::create('DomainValidationHeader', _t('DomainSpecificMemberProfileFieldExtension.DomainValidationHeader', 'Domain Validation'), 3), 'AllowedDomains');
// Add some helper text
$fields->insertBefore(LiteralField::create('DomainValidationHelper', _t('DomainSpecificMemberProfileFieldExtension.DomainValidationHelper', 'Allow or disallow profile registration based on the domain of the user\'s email address. One domain can be specified per line. You can use the wildcards (e.g.: <em>*.example.com</em>) to catch subdomains.')), 'AllowedDomains');
} else {
// If it's any other Member profile field remove the additional field.
$fields->removeByName('AllowedDomains');
$fields->removeByName('DisallowedDomains');
$fields->removeByName('ShowDomainsOnError');
}
}
开发者ID:firebrandhq,项目名称:domain-specific-memberprofiles,代码行数:19,代码来源:DomainSpecificMemberProfileFieldExtension.php
示例6: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->insertBefore(new Tab('MembershipDetails', 'Membership Details'), 'Main');
//move first and ;astname
$fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('FirstName'));
$fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('Surname'));
$fields->addFieldToTab('Root.MembershipDetails', $fields->dataFieldByName('Email'));
$fields->addFieldToTab('Root.MembershipDetails', $region = DropdownField::create('RegionID', 'Region', Region::get()->map('ID', 'Title')));
$region->setEmptyString(' ');
$fields->addFieldToTab('Root.MembershipDetails', DropdownField::create('MembershipStatus', 'Membership Status', $this->owner->dbObject('MembershipStatus')->enumValues()));
$fields->addFieldToTab('Root.MembershipDetails', $expiry = DateField::create('ExpiryDate'));
$fields->addFieldToTab('Root.MembershipDetails', DropdownField::create('Discount', 'Discount', $this->owner->dbObject('Discount')->enumValues()));
$fields->addFieldToTab('Root.MembershipDetails', $discountExpiry = DateField::create('DiscountExpiryDate'));
$fields->addFieldToTab('Root.MembershipDetails', $joined = DateField::create('JoinedDate'));
$fields->addFieldToTab('Root.MembershipDetails', TextareaField::create('NotesForMember'));
if ($this->owner->MembershipStatus !== "Not applied") {
$fields->addFieldToTab('Root.MembershipDetails', TextField::create('MemberNumber'));
}
$fields->addFieldToTab('Root.MembershipDetails', TextField::create('HomePhone'));
$fields->addFieldToTab('Root.MembershipDetails', TextField::create('WorkPhone'));
$fields->addFieldToTab('Root.MembershipDetails', TextField::create('MobilePhone'));
$fields->addFieldToTab('Root.MembershipDetails', TextareaField::create('Address'));
$fields->addFieldToTab('Root.MembershipDetails', TextField::create('Occupation'));
$fields->addFieldToTab('Root.MembershipDetails', TextField::create('BirthDate'));
$expiry->setConfig('showcalendar', true);
$expiry->setConfig('showdropdown', true);
$expiry->setConfig('dateformat', 'dd-MM-YYYY');
$discountExpiry->setConfig('showcalendar', true);
$discountExpiry->setConfig('showdropdown', true);
$discountExpiry->setConfig('dateformat', 'dd-MM-YYYY');
$joined->setConfig('showcalendar', true);
$joined->setConfig('showdropdown', true);
$joined->setConfig('dateformat', 'dd-MM-YYYY');
}
示例7: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$metaFieldTitle = new TextField("MetaTitle", $this->owner->fieldLabel('MetaTitle'));
$metaFieldTitle->setRightTitle(_t('SiteTree.METATITLEHELP', 'Shown at the top of the browser window and used as the "linked text" by search engines.'))->addExtraClass('help');
$fields->insertBefore($metaFieldTitle, Config::inst()->get('MetaTitleExtension', 'InsertBefore'));
return $fields;
}
示例8: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$extFields = self::$db;
$fields->removeByName(array_keys($extFields));
if (!$this->owner->WordpressID) {
return;
}
$compositeFields = array();
foreach ($extFields as $name => $type) {
$value = $this->owner->getField($name);
$compositeFields[$name] = ReadonlyField::create($name . '_Readonly', FormField::name_to_label($name), $value);
}
if ($compositeFields) {
$wordpressCompositeField = ToggleCompositeField::create('WordpressCompositeField', 'Wordpress', $compositeFields)->setHeadingLevel(4);
if ($fields->fieldByName('Metadata')) {
$fields->insertBefore($wordpressCompositeField, 'Metadata');
} else {
if ($fields->fieldByName('Root')) {
$fields->addFieldToTab('Root.Main', $wordpressCompositeField);
} else {
$fields->push($wordpressCompositeField);
}
}
}
}
开发者ID:silbinarywolf,项目名称:silverstripe-wordpressmigrationtools,代码行数:25,代码来源:WordpressImportDataExtension.php
示例9: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->insertBefore($shoptab = new Tab('Shop', 'Shop'), 'Access');
$fields->addFieldsToTab("Root.Shop", new TabSet("ShopTabs", $maintab = new Tab("Main", TreeDropdownField::create('TermsPageID', _t("ShopConfig.TERMSPAGE", 'Terms and Conditions Page'), 'SiteTree'), TreeDropdownField::create("CustomerGroupID", _t("ShopConfig.CUSTOMERGROUP", "Group to add new customers to"), "Group"), UploadField::create('DefaultProductImage', _t('ShopConfig.DEFAULTIMAGE', 'Default Product Image'))), $countriestab = new Tab("Countries", CheckboxSetField::create('AllowedCountries', 'Allowed Ordering and Shipping Countries', self::config()->iso_3166_country_codes))));
$fields->removeByName("CreateTopLevelGroups");
$countriestab->setTitle("Allowed Countries");
}
示例10: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->insertBefore(new CheckboxField('GenerateMetaData', _t('MetaManager.GENERATEMETADATA', 'Generate Meta-data automatically from the page content'), $this->owner->GenerateMetaData), 'MetaDescription');
if (self::$hide_extra_meta == 1) {
$fields->removeByName('ExtraMeta');
$fields->removeByName('ExtraMeta_original');
}
}
示例11: updateCMSFields
function updateCMSFields(FieldList $fields)
{
$fields->insertBefore($uploadField = new SortableUploadField("FeaturedImages", _t("FeaturedImage.FeaturedImages", "Page Image(s)")), "Content");
$uploadField->setFolderName(Config::inst()->get($this->owner->class, 'upload_folder'));
//$uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
$uploadField->setAllowedFileCategories('image');
$uploadField->setAllowedMaxFileNumber(Config::inst()->get($this->owner->class, 'max_featured_images'));
}
示例12: updateCMSFields
/**
* Fields to display this {@link Payment} in the CMS, removed some of the
* unnecessary fields.
*
* @see DataObjectDecorator::updateCMSFields()
* @return FieldList
*/
function updateCMSFields(FieldList $fields)
{
$fields->removeByName('OrderID');
$fields->removeByName('HTTPStatus');
$fields->removeByName('Amount');
$str = $this->owner->dbObject('Amount')->Nice();
$fields->insertBefore(TextField::create('Amount_', 'Amount', $str), 'Method');
return $fields;
}
示例13: updateCMSFields
/**
* {@inheritdoc}
*/
public function updateCMSFields(FieldList $fields)
{
$excluded = $this->owner->getExcludedSiteTreeClassNames();
if (!empty($excluded)) {
$pages = SiteTree::get()->filter(array('ParentID' => $this->owner->ID, 'ClassName' => $excluded))->sort('"SiteTree"."Created" DESC');
$gridField = new BlogFilter_GridField('ChildPages', $this->getLumberjackTitle(), $pages, $this->getLumberjackGridFieldConfig());
$tab = new Tab('ChildPages', $this->getLumberjackTitle(), $gridField);
$fields->insertBefore($tab, 'Main');
}
}
示例14: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->insertBefore(TextField::create("PersonalTitle", "Title (Dr., Hon. etc.)"), "FirstName");
$fields->insertAfter(TextField::create("Credentials"), "Surname");
$fields->insertAfter(TextField::create("JobTitle", "Job Title"), "Credientials");
$fields->insertAfter(TextField::create("Role"), "JobTitle");
$fields->insertAfter(TextField::create("Twitter", "Twitter User Name")->setDescription("Do NOT include the '@'"), "Email");
$fields->insertAfter(TextField::create("Facebook", "Facebook Page or Profile"), "Twitter");
$fields->insertAfter(TextField::create("GooglePlus", "Google+ Profile"), "Facebook");
$fields->insertAfter(UploadField::create("Headshot"), "GooglePlus");
$fields->insertAfter(HTMLEditorField::create("Bio"), "Headshot");
}
示例15: updateCMSFields
/**
* Add URL field and a read-only External ID field to CMS form.
*
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
{
$descriptionFieldName = $this->getModelFieldName(self::DescriptionFieldName);
$fields->insertBefore(new TextField($this->linkFieldName(), 'Feed URL'), $descriptionFieldName);
$fields->insertAfter(new DropdownField(self::FeedTypeFieldName, 'Type', static::feed_types()), $descriptionFieldName);
$fields->insertAfter($field = new TextField(self::XPathFieldName, 'XPath'), $descriptionFieldName);
$field->setAttribute('placeholder', $this->defaultXPath());
$fields->insertAfter(new CheckboxField(self::ValidateFeedFieldName, 'Validate feed', true), $descriptionFieldName);
if ($idFieldName = $this->externalIDFieldName()) {
if ($externalID = $this->owner->{$idFieldName}) {
$fields->push(new LiteralField($externalID, 'Feed ID', "<p>{$externalID}</p>"));
}
}
}