本文整理汇总了PHP中DataObject::getCMSFields方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObject::getCMSFields方法的具体用法?PHP DataObject::getCMSFields怎么用?PHP DataObject::getCMSFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObject
的用法示例。
在下文中一共展示了DataObject::getCMSFields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$HSEAScore = GroupedList::create(Score::get()->sort('ClassName'));
$fields->addFieldToTab("Root.Main", new OptionSetField('Status', 'Status', singleton('Project')->dbObject('Status')->enumValues()));
$fields->addFieldToTab("Root.Main", new CheckboxsetField('Scores', 'Check List', $HSEAScore));
$impact = GroupedList::create(Impact::get()->sort('Title'));
$fields->addFieldToTab("Root.Main", new CheckboxsetField('Impacts', 'Impact', $impact));
//$FinScore= DataObject::get('Score' ,"ClassName = 'Financial'");
// $fields->addFieldToTab("Root.Main", new CheckboxsetField('Scores', 'Financial', $FinScore));
// $ServScore= DataObject::get('Score', "ClassName = 'Service'");
// $fields->addFieldToTab("Root.Main", new CheckboxsetField('Scores', 'Service', $ServScore));
/*$gridFieldConfig = GridFieldConfig::create()->addComponents(
new GridFieldToolbarHeader(),
new GridFieldAddNewButton('toolbar-header-right'),
new GridFieldSortableHeader(),
new GridFieldDataColumns(),
new GridFieldPaginator(15),
new GridFieldEditButton(),
new GridFieldDeleteAction(),
new GridFieldDetailForm()
);
$gridfield = new GridField("Tasks", "Tasks", $this->Tasks(), $gridFieldConfig);
$fields->addFieldToTab('Root.Tasks', $gridfield);*/
$fields->addFieldToTab("Root.Main", $dateField = new DateField("DueDate", "Date Due"));
$dateField->setConfig('showcalendar', true);
$dateField->setConfig('dateformat', 'dd/MM/YYYY');
return $fields;
}
示例2: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$cssFiles = new UploadField('CustomCSSFiles', _t('UserTemplatesExtension.CustomCSSFiles', "Custom CSS Files"));
$jsFiles = new UploadField('CustomJSFiles', _t('UserTemplatesExtension.CustomJSFiles', "Custom JS Files"));
$cssFiles->setFolderName(self::$css_folder);
$jsFiles->setFolderName(self::$js_folder);
$fields->removeByName('CustomCSSFiles');
$fields->removeByName('CustomJSFiles');
$templates = $this->fileBasedTemplates();
if (count($templates)) {
$fields->addFieldToTab('Root.Main', $dd = new DropdownField('ContentFile', _t('UserTemplatesExtension.CONTENT_FILE', 'File containing template'), $templates));
$dd->setRightTitle('If selected, any Content set above will be ignored');
} else {
$fields->removeByName('ContentFile');
}
$fields->push($strict = CheckboxField::create('StrictActions', _t('UserTemplates.STRICT_ACTIONS', 'Require actions to be explicitly overridden')));
$text = <<<DOC
When applied to a page type that has sub-actions, an action template will be used ONLY if the action is listed below, and this main
\t template will only be used for the 'index' action. If this is not checked, then this template will be used for ALL actions
\t in the page it is applied to.
DOC;
$strict->setRightTitle(_t('UserTemplates.STRICT_HELP', $text));
$templates = DataList::create('UserTemplate')->filter(array('ID:not' => $this->ID));
if ($templates->count()) {
$templates = $templates->map();
$fields->addFieldToTab('Root.Main', $kv = new KeyValueField('ActionTemplates', _t('UserTemplates.ACTION_TEMPLATES', 'Action specific templates'), array(), $templates));
$kv->setRightTitle(_t('UserTemplates.ACTION_TEMPLATES_HELP', 'Specify an action name and select another user defined template to handle a specific action. Only used for Layout templates'));
}
$fields->addFieldToTab('Root.Main', $cssFiles);
$fields->addFieldToTab('Root.Main', $jsFiles);
return $fields;
}
示例3: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
// the date field is added in a bit more complex manner so it can have the dropdown date picker
$EventStartDate = new DateField('EventStartDate', 'First Day of Event');
$EventStartDate->setConfig('showcalendar', true);
$EventStartDate->setConfig('showdropdown', true);
$fields->addFieldToTab('Root.Main', $EventStartDate, 'Content');
// same things for the event end date
$EventEndDate = new DateField('EventEndDate', 'Last Day of Event');
$EventEndDate->setConfig('showcalendar', true);
$EventEndDate->setConfig('showdropdown', true);
$fields->addFieldToTab('Root.Main', $EventEndDate, 'Content');
$fields->addFieldToTab('Root.Main', new TextField('EventLink', 'Event Button Link (URL)'), 'Content');
$fields->addFieldToTab('Root.Main', new TextField('EventLinkLabel', 'Event Button Label'), 'Content');
$fields->addFieldToTab('Root.Main', new TextField('EventLocation', 'Event Location'), 'Content');
$fields->addFieldToTab('Root.Main', new TextField('EventSponsor', 'Event Sponsor'), 'Content');
$fields->addFieldToTab('Root.Main', new TextField('EventSponsorLogoUrl', 'URL of the Event Sponsor Logo'), 'Content');
$fields->addFieldToTab('Root.Main', new CheckboxField('IsSummit', 'Official OpenStack Summit Event'), 'Content');
// remove unneeded fields
$fields->removeFieldFromTab("Root.Main", "MenuTitle");
// rename fields
$fields->renameField("Content", "Event Page Content");
$fields->renameField("Title", "Event Title");
return $fields;
}
示例4: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js');
Requirements::javascript('eventmanagement/javascript/event-ticket-cms.js');
$fields->removeByName('EventID');
$fields->removeByName('StartType');
$fields->removeByName('StartDate');
$fields->removeByName('StartDays');
$fields->removeByName('StartHours');
$fields->removeByName('StartMins');
$fields->removeByName('EndType');
$fields->removeByName('EndDate');
$fields->removeByName('EndDays');
$fields->removeByName('EndHours');
$fields->removeByName('EndMins');
if (class_exists('Payment')) {
$fields->insertBefore(new OptionSetField('Type', 'Ticket type', array('Free' => 'Free ticket', 'Price' => 'Fixed price ticket')), 'Price');
} else {
$fields->removeByName('Type');
$fields->removeByName('Price');
}
foreach (array('Start', 'End') as $type) {
$fields->addFieldsToTab('Root.Main', array(new OptionSetField("{$type}Type", "{$type} sales at", array('Date' => 'A specific date and time', 'TimeBefore' => 'A time before the event starts')), $dateTime = new DatetimeField("{$type}Date", ''), $before = new FieldGroup("{$type}Offset", new NumericField("{$type}Days", 'Days'), new NumericField("{$type}Hours", 'Hours'), new NumericField("{$type}Mins", 'Minutes'))));
$before->setName("{$type}Offset");
$before->setTitle(' ');
$dateTime->getDateField()->setConfig('showcalendar', true);
$dateTime->getTimeField()->setConfig('showdropdown', true);
}
$fields->addFieldsToTab('Root.Advanced', array(new TextareaField('Description', 'Description'), new NumericField('MinTickets', 'Minimum tickets per order'), new NumericField('MaxTickets', 'Maximum tickets per order')));
return $fields;
}
示例5: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeFieldsFromTab('Root.Main', array('ServicesPageID', 'SortOrder'));
$fields->dataFieldByName('Content')->setRows(20);
return $fields;
}
示例6: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
// create a dedicated tab for open layers
$fields->addFieldsToTab("Root.Main", array(new LiteralField("StyleMapHelp", "<h2>Style Map Help</h2>"), new LiteralField("MapLabel1", "Please click <a href='map-style-help?stage=Stage' target='_help'>here<a/> for more help.")));
return $fields;
}
示例7: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName("AddressID");
$fields->addFieldToTab("Root.Main", HasOneButtonField::create("Address", "Address", $this));
return $fields;
}
示例8: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName("Title");
$fields->addFieldToTab("Root.Main", new HeaderField($name = "TitleHeader", "search for: '" . $this->Title . "'", 1), "RedirectTo");
$fields->removeByName("Recommendations");
if (!$this->RedirectTo) {
$source = SiteTree::get()->filter(array("ShowInSearch" => 1))->exclude(array("ClassName" => "SearchPlusPage"));
$sourceArray = $sourc->map()->toArray();
//$fields->addFieldToTab("Root.Main", new MultiSelectField($name = "Recommendations", $title = "Recommendations", $sourceArray));
$fields->addFieldToTab("Root.Main", new TreeMultiselectField($name = "Recommendations", $title = "Recommendations", "SiteTree"));
} else {
$fields->addFieldToTab("Root.Main", new LiteralField($name = "Recommendations", '<p>This search phrase cannot have recommendations, because it redirects to <i>' . $this->RedirectTo . '</i></p>'));
}
$page = SearchPlusPage::get()->first();
if (!$page) {
user_error("Make sure to create a SearchPlusPage to make proper use of this module", E_USER_NOTICE);
} else {
$fields->addFieldToTab("Root.Main", new LiteralField($name = "BackLinks", $content = '<p>
Review a graph of all <a href="' . $page->Link() . 'popularsearchwords/100/10/">Popular Search Phrases</a> OR
<a href="' . $page->Link() . 'results/?Search=' . urlencode($this->Title) . '&action_results=Search&redirect=1">try this search</a>.
</p>'));
}
return $fields;
}
示例9: getCMSFields
/**
*
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->push(new TextField('OPColor', 'OP Color'));
$fields->push(new TextField('CSSColor', 'CSS Color'));
return $fields;
}
示例10: getCMSFields
/**
* Add the Meta tag CMS fields
*
* @since version 1.0.0
*
* @return object Return the current page fields
**/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Main');
$fields->addFieldsToTab('Root.SEO', [HeaderField::create('Meta Tag'), DropdownField::create('Type', 'Tag type', $this->tagTypes()), TextField::create('Name'), TextField::create('Value'), HiddenField::create('PageID')]);
return $fields;
}
示例11: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName(['CaseStudyHolderID']);
$this->extend('updateCMSFields', $fields);
return $fields;
}
示例12: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->replaceField("From", $from = new DateField("From", "Valid From - add any date and time"));
$fields->replaceField("Until", $until = new DateField("Until", "Valid Until - add any date and time"));
$fields->replaceField("NewPrice", new CurrencyField("NewPrice", "PRICE (OPTION 1 / 3) - only enter if there is a set new price independent of the 'standard' price."));
$fields->replaceField("Percentage", new NumericField("Percentage", "PERCENTAGE (OPTIONAL 2/ 3) discount from 0 (0% discount) to 100 (100% discount)."));
$fields->replaceField("Reduction", new CurrencyField("Reduction", "REDUCTION (OPTION 3 /3 ) - e.g. if you enter 2.00 then the new price will be the standard product price minus 2."));
if (!$this->ID) {
$fields->addFieldToTab("Root.Main", new LiteralField("SaveFirst", "<p>Please save first - and then select security groups / countries</p>"));
$fields->removeByName("NoLongerValid");
}
if ($groups = Group::get()->count()) {
$groups = Group::get();
$fields->replaceField("Groups", new CheckboxSetField("Groups", "Who", $groups->map()->toArray()));
} else {
$fields->removeByName("Groups");
}
if ($ecommerceCountries = EcommerceCountry::get()) {
$fields->replaceField("EcommerceCountries", new CheckboxSetField("EcommerceCountries", "Where", $ecommerceCountries->map()->toArray()));
} else {
$fields->removeByName("EcommerceCountries");
}
if (DiscountCouponOption::get()->count()) {
$fields->replaceField("DiscountCouponOptions", new CheckboxSetField("DiscountCouponOptions", "Discount Coupons", DiscountCouponOption::get()->map()->toArray()));
} else {
$fields->removeByName("DiscountCouponOptions");
}
$from->setConfig('showcalendar', true);
$until->setConfig('showcalendar', true);
return $fields;
}
示例13: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->dataFieldByName('Link')->setRightTitle('Fully qualified (http://www.google.com) or internal (section/page)');
$fields->dataFieldByName('isLinkExternal')->setTitle('Open link in new window?');
return $fields;
}
示例14: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', new HeaderField('ProfileSectionTitle', _t('MemberProfiles.PROFILESECTION', 'Profile Section')), 'CustomTitle');
$fields->addFieldToTab('Root.Main', new ReadonlyField('DefaultTitle', _t('MemberProfiles.SECTIONTYPE', 'Section type')), 'CustomTitle');
return $fields;
}
示例15: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Main", $this->getCountryField(), 'State');
$fields->removeByName("MemberID");
return $fields;
}