本文整理汇总了PHP中Page::getCMSFields方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::getCMSFields方法的具体用法?PHP Page::getCMSFields怎么用?PHP Page::getCMSFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::getCMSFields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$config = GridFieldConfig_RecordEditor::create();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('IndustryName' => 'IndustryName', 'Active' => 'Active'));
$industries = new GridField('UserStoriesIndustry', 'User Stories Industry', UserStoriesIndustry::get(), $config);
$fields->addFieldsToTab('Root.Industries', $industries);
$config = GridFieldConfig_RecordEditor::create();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('UserStory.Title' => 'UserStory', 'UserStoriesIndustry.IndustryName' => 'Industry'));
$Featured = new GridField('UserStoriesFeatured', 'User Stories Featured', UserStoriesFeatured::get(), $config);
$fields->addFieldsToTab('Root.FeaturedStories', $Featured);
$config = GridFieldConfig_RecordEditor::create();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('LinkName' => 'LinkName', 'UserStory.Title' => 'UserStory'));
$links = new GridField('UserStoriesLink', 'User Stories Link', UserStoriesLink::get(), $config);
$fields->addFieldsToTab('Root.Links', $links);
$config = GridFieldConfig_RecordEditor::create();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Topic' => 'Topic'));
$topics = new GridField('UserStoriesTopics', 'User Stories Topics', UserStoriesTopics::get(), $config);
$fields->addFieldsToTab('Root.Topics', $topics);
$config = GridFieldConfig_RecordEditor::create();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('UserStoriesTopics.Topic' => 'Topic', 'LabelTitle' => 'Title'));
$TopicsFeatured = new GridField('UserStoriesTopicsFeatured', 'User Stories Topics Featured', UserStoriesTopicsFeatured::get(), $config);
$fields->addFieldsToTab('Root.FeaturedOnSlider', $TopicsFeatured);
$config = GridFieldConfig_RecordEditor::create();
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Type' => 'Type', 'Content' => 'Content'));
$slides = new GridField('UserStoriesSlides', 'User Stories Slides', UserStoriesSlides::get(), $config);
$fields->addFieldsToTab('Root.Slides', $slides);
return $fields;
}
示例2: getCMSFields
public function getCMSFields()
{
$DefaultAlbumCoverField = UploadField::create('DefaultAlbumCover');
$DefaultAlbumCoverField->folderName = "PhotoGallery";
$DefaultAlbumCoverField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
$fields = parent::getCMSFields();
$AlbumsGridField = new GridField("PhotoAlbums", "Album", $this->PhotoAlbums(), GridFieldConfig::create()->addComponent(new GridFieldToolbarHeader())->addComponent(new GridFieldAddNewButton('toolbar-header-right'))->addComponent(new GridFieldSortableHeader())->addComponent(new GridFieldDataColumns())->addComponent(new GridFieldPaginator(50))->addComponent(new GridFieldEditButton())->addComponent(new GridFieldDeleteAction())->addComponent(new GridFieldDetailForm())->addComponent(new GridFieldFilterHeader())->addComponent($sortable = new GridFieldSortableRows('SortID')));
if ($this->AlbumDefaultTop == true) {
$sortable->setAppendToTop(true);
}
$fields->addFieldToTab("Root.Albums", $AlbumsGridField);
$fields->addFieldToTab("Root.Config", HeaderField::create("Album Settings"));
$fields->addFieldToTab("Root.Config", $DefaultAlbumCoverField);
$fields->addFieldToTab("Root.Config", SliderField::create('AlbumsPerPage', 'Number of Albums Per Page', 1, 25));
$fields->addFieldToTab("Root.Config", SliderField::create("AlbumThumbnailWidth", "Album Cover Thumbnail Width", 50, 400));
$fields->addFieldToTab("Root.Config", SliderField::create("AlbumThumbnailHeight", "Album Cover Thumbnail Height", 50, 400));
$fields->addFieldToTab("Root.Config", CheckboxField::create("ShowAllPhotoAlbums")->setTitle("Show photo album even if it's empty"));
$fields->addFieldToTab("Root.Config", CheckboxField::create("AlbumDefaultTop")->setTitle("Sort new albums to the top by default"));
$fields->addFieldToTab("Root.Config", HeaderField::create("Photo Settings"));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotosPerPage", "Number of Photos Per Page", 1, 50));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotoThumbnailWidth", "Photo Thumbnail Width", 50, 400));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotoThumbnailHeight", "Photo Thumbnail Height", 50, 400));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotoFullWidth", "Photo Fullsize Width", 400, 1200));
$fields->addFieldToTab("Root.Config", SliderField::create("PhotoFullHeight", "Photo Fullsize Height", 400, 1200));
$fields->addFieldToTab("Root.Config", CheckboxField::create("PhotoDefaultTop")->setTitle("Sort new photos to the top by default"));
return $fields;
}
示例3: getCMSFields
/**
* Setup the CMS Fields for the User Defined Form
*
* @return FieldSet
*/
public function getCMSFields() {
$fields = parent::getCMSFields();
// field editor
$fields->addFieldToTab("Root.Content."._t('UserDefinedForm.FORM', 'Form'), new FieldEditor("Fields", 'Fields', "", $this ));
// view the submissions
$fields->addFieldToTab("Root.Content."._t('UserDefinedForm.SUBMISSIONS','Submissions'), new SubmittedFormReportField( "Reports", _t('UserDefinedForm.RECEIVED', 'Received Submissions'), "", $this ) );
// who do we email on submission
$emailRecipients = new ComplexTableField(
$this,
'EmailRecipients',
'UserDefinedForm_EmailRecipient',
array(
'EmailAddress' => 'Email',
'EmailSubject' => 'Subject',
'EmailFrom' => 'From'
),
'getCMSFields_forPopup',
"FormID = '$this->ID'"
);
$emailRecipients->setAddTitle(_t('UserDefinedForm.AEMAILRECIPIENT', 'A Email Recipient'));
$fields->addFieldToTab("Root.Content."._t('UserDefinedForm.EMAILRECIPIENTS', 'Email Recipients'), $emailRecipients);
// text to show on complete
$onCompleteFieldSet = new FieldSet(
new HtmlEditorField( "OnCompleteMessage", _t('UserDefinedForm.ONCOMPLETELABEL', 'Show on completion'),3,"",_t('UserDefinedForm.ONCOMPLETEMESSAGE', $this->OnCompleteMessage), $this )
);
$fields->addFieldsToTab("Root.Content."._t('UserDefinedForm.ONCOMPLETE','On complete'), $onCompleteFieldSet);
return $fields;
}
示例4: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
// Main Content tab
// Carousel tab
$carouselItemsGrid = null;
// Manay to many relations can only be established if we have an id. So put a place holder instead of a grid if this is a new object.
if ($this->ID == 0) {
$carouselItemsGrid = TextField::create("CarouselItems", "Carousel Items")->setDisabled(true)->setValue("Page must be saved once before adding Carousel Items.");
} else {
$carouselItemsGrid = new GridField('CarouselItems', 'Carousel', $this->CarouselItems()->sort('Archived'), GridFieldConfig_RelationEditor::create());
$carouselItemsGridUploadComponent = new GridFieldBulkUpload("Image");
$carouselItemsGridUploadComponent->setUfSetup("setFolderName", $this->ImageFolder("carousel"));
$carouselItemsGrid->setModelClass('CarouselItem')->getConfig()->addComponent($carouselItemsGridUploadComponent)->addComponent(new GridFieldOrderableRows("SortID"));
}
$fields->addFieldToTab('Root.Carousel', $carouselItemsGrid);
// Links
$fields->addFieldToTab('Root.Links', new TreeDropdownField('LearnMorePageID', 'Page to link the "Learn More" button to:', 'SiteTree'));
$fields->addFieldToTab('Root.Links', new TextField('LearnMoreButtonText', 'Text to display on the "Learn More" button:', 'SiteTree'));
$quickLinksGrid = new GridField('Quicklinks', 'Quicklinks', $this->Quicklinks(), GridFieldConfig_RelationEditor::create());
$quickLinksGrid->setModelClass('Quicklink');
$quickLinksFieldGroup = FieldGroup::create($quickLinksGrid)->setTitle('Quick Links');
$quickLinksFieldGroup->setName("QuicklinkGroup");
$fields->addFieldToTab('Root.Links', $quickLinksFieldGroup);
$fields->removeByName('Translations');
$fields->removeByName('Import');
$fields->addFieldToTab('Root.Features', ToggleCompositeField::create('FeatureOne', _t('SiteTree.FeatureOne', 'Feature One'), array(new TextField('FeatureOneTitle', 'Title'), new DropdownField('FeatureOneCategory', 'Category', singleton('ExpressHomePage')->dbObject('FeatureOneCategory')->enumValues()), new HTMLEditorField('FeatureOneContent', 'Content'), new TreeDropdownField('FeatureOneLinkID', 'Page to link to', 'SiteTree'), new TextField('FeatureOneButtonText', 'Button text')))->setHeadingLevel(3));
$fields->addFieldToTab('Root.Features', ToggleCompositeField::create('FeatureTwo', _t('SiteTree.FeatureTwo', 'Feature Two'), array(new TextField('FeatureTwoTitle', 'Title'), new DropdownField('FeatureTwoCategory', 'Category', singleton('ExpressHomePage')->dbObject('FeatureTwoCategory')->enumValues()), new HTMLEditorField('FeatureTwoContent', 'Content'), new TreeDropdownField('FeatureTwoLinkID', 'Page to link to', 'SiteTree'), new TextField('FeatureTwoButtonText', 'Button text')))->setHeadingLevel(3));
return $fields;
}
示例5: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeFieldsFromTab('Root.Main', array('Title', 'Content', 'URLSegment', 'MenuTitle'));
$fields->addFieldsToTab('Root.Main', array(TextField::create('Phone', 'Phone'), TextField::create('Fax', 'Fax'), TextField::create('Address', 'Address')), 'Metadata');
return $fields;
}
示例6: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Main", new LiteralField("Desc", "<h2>First Child Redirect Page</h2><p>This page automatically redirects to it's first child page.</p>"));
$fields->removeFieldFromTab("Root.Main", "Content");
return $fields;
}
示例7: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$f = new SortableGalleryField('Images', 'My Images');
$fields->addFieldToTab('Root.Images', $f);
return $fields;
}
示例8: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldsToTab("Root.SuccessContent", array(TextField::create("Currency"), TextField::create("SuccessTitle"), HTMLEditorField::create("SuccessContent")));
$fields->addFieldToTab("Root.Invoices", GridField::create("Invoices", "Invoices", $this->Invoices(), GridFieldConfig_RecordEditor::create()));
return $fields;
}
示例9: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
// Remove content since this page redirects to first consultation
$fields->removeByName('Content');
return $fields;
}
示例10: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$manager = new GridField('CommMembers', 'CommMember', $this->CommMembers());
$fields->addFieldToTab("Root.CommMembers", $manager);
return $fields;
}
示例11: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('PageBuilder');
/* =========================================
* Images
=========================================*/
$fields->addFieldToTab('Root.Main', new UploadField('Image'), 'Content');
/* =========================================
* Menu Item Details
=========================================*/
$fields->addFieldToTab('Root.Main', $price = new CurrencyField('Price'), 'Content');
$price->setRightTitle('To add extra price options e.g Small, Large please add a variation under the "Variations" tab above');
$fields->addFieldToTab('Root.Main', $ingredients = new HtmlEditorField('Ingredients'), 'Metadata');
$ingredients->setRows(15);
/* =========================================
* Variations
=========================================*/
$config = GridFieldConfig_RelationEditor::create(10);
$config->addComponent(new GridFieldSortableRows('SortOrder'))->addComponent(new GridFieldDeleteAction());
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title' => 'Title', 'Price' => 'Price'));
$gridField = new GridField('Variations', 'Variations', $this->owner->MenuVariations(), $config);
$fields->addFieldToTab('Root.Variations', $gridField);
return $fields;
}
示例12: getCMSFields
public function getCMSFields()
{
$f = parent::getCMSFields();
$homes = Home::get();
$f->addFieldToTab('Root.Homes', new GridField('HomeGrid', 'Homes', $homes, GridFieldConfig_RelationEditor::create()));
return $f;
}
示例13: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', $image = new UploadField('Image', _t('TestimonialPage.ImageLabel', 'Image')), 'Content');
$image->setFolderName('Uploads/testimonials');
return $fields;
}
示例14: getCMSFields
/**
* Setup the CMS Fields for the User Defined Form
*
* @return FieldSet
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
// define tabs
$fields->findOrMakeTab('Root.Form', _t('UserDefinedForm.FORM', 'Form'));
$fields->findOrMakeTab('Root.Options', _t('UserDefinedForm.OPTIONS', 'Options'));
$fields->findOrMakeTab('Root.EmailRecipients', _t('UserDefinedForm.EMAILRECIPIENTS', 'Email Recipients'));
$fields->findOrMakeTab('Root.OnComplete', _t('UserDefinedForm.ONCOMPLETE', 'On Complete'));
$fields->findOrMakeTab('Root.Submissions', _t('UserDefinedForm.SUBMISSIONS', 'Submissions'));
// field editor
$fields->addFieldToTab("Root.Form", new FieldEditor("Fields", 'Fields', "", $this));
// view the submissions
$fields->addFieldToTab("Root.Submissions", new CheckboxField('DisableSaveSubmissions', _t('UserDefinedForm.SAVESUBMISSIONS', "Disable Saving Submissions to Server")));
$fields->addFieldToTab("Root.Submissions", new SubmittedFormReportField("Reports", _t('UserDefinedForm.RECEIVED', 'Received Submissions'), "", $this));
UserDefinedForm_EmailRecipient::$summary_fields = array('EmailAddress' => _t('UserDefinedForm.EMAILADDRESS', 'Email'), 'EmailSubject' => _t('UserDefinedForm.EMAILSUBJECT', 'Subject'), 'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From'));
// who do we email on submission
$emailRecipients = new GridField("EmailRecipients", "EmailRecipients", $this->EmailRecipients(), GridFieldConfig_RecordEditor::create(10));
$fields->addFieldToTab("Root.EmailRecipients", $emailRecipients);
// text to show on complete
$onCompleteFieldSet = new FieldList($editor = new HtmlEditorField("OnCompleteMessage", _t('UserDefinedForm.ONCOMPLETELABEL', 'Show on completion'), _t('UserDefinedForm.ONCOMPLETEMESSAGE', $this->OnCompleteMessage)));
$editor->setRows(3);
$fields->addFieldsToTab("Root.OnComplete", $onCompleteFieldSet);
$fields->addFieldsToTab("Root.Options", $this->getFormOptions());
return $fields;
}
示例15: getCMSFields
/**
* Returns a FieldList with which to create the main editing form.
*
* @return FieldList The fields to be displayed in the CMS.
*/
public function getCMSFields()
{
// Get the CMS fields
$fields = parent::getCMSFields();
// Update the existing fields with labels
$nameField = $fields->dataFieldByName("Title");
if ($nameField) {
$nameField->setRightTitle("Staff members name (John Smith etc)");
}
// Add the fields to the CMS
$fields->addFieldToTab("Root.Main", TextField::create("Position", _t("StaffProfilePage.PositionTitle", "Position")), "Content");
$fields->addFieldToTab("Root.Main", EmailField::create("Email", _t("StaffProfilePage.EmailTitle", "Email address")), "Content");
$fields->addFieldToTab("Root.Main", TextField::create("Phone", _t("StaffProfilePage.PhoneTitle", "Phone")), "Content");
$fields->addFieldToTab("Root.Categories", GridField::create("Categories", _t("StaffProfilePage.CategoriesTitle", "Categories"), $this->Categories(), StaffProfilePage_Category::getGridFieldConfig()));
// Add the thumbnail field
$uploadField = UploadField::create("Thumbnail", _t("StaffProfilePage.ThumbnailTitle", "Thumbnail"));
$uploadField->setFolderName('Staff');
$uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
$sizeMB = 0.3;
// MB
$size = $sizeMB * 1024 * 1024;
// Bytes
$uploadField->getValidator()->setAllowedMaxFileSize($size);
$fields->addFieldToTab("Root.Main", $uploadField, "Content");
$this->extend('updateCMSFields', $fields);
return $fields;
}