本文整理汇总了PHP中CheckboxField::create方法的典型用法代码示例。如果您正苦于以下问题:PHP CheckboxField::create方法的具体用法?PHP CheckboxField::create怎么用?PHP CheckboxField::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CheckboxField
的用法示例。
在下文中一共展示了CheckboxField::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$createdDate = new Date();
$createdDate->setValue($this->Created);
$reviewer = $this->Member()->Name;
$email = $this->Member()->Email;
$star = "★";
$emptyStar = "☆";
$fields->insertBefore(LiteralField::create('reviewer', '<p>Written by <strong>' . $this->getMemberDetails() . '</strong><br />' . $createdDate->Format('l F jS Y h:i:s A') . '</p>'), 'Title');
$fields->insertBefore(CheckboxField::create('Approved'), 'Title');
$starRatings = $this->StarRatings();
foreach ($starRatings as $starRating) {
$cat = $starRating->StarRatingCategory;
$stars = str_repeat($star, $starRating->Rating);
$ratingStars = $stars;
$maxRating = $starRating->MaxRating - $starRating->Rating;
$emptyStarRepeat = str_repeat($emptyStar, $maxRating);
$emptyStars = $emptyStarRepeat;
/* 4/5 Stars */
$ratingInfo = $ratingStars . $emptyStars . ' (' . $starRating->Rating . ' of ' . $starRating->MaxRating . ' Stars)';
$fields->insertBefore(ReadonlyField::create('rating_' . $cat, $cat, html_entity_decode($ratingInfo, ENT_COMPAT, 'UTF-8')), 'Title');
}
$fields->removeByName('StarRatings');
$fields->removeByName('MemberID');
$fields->removeByName('ProductID');
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: updateCMSFields
public function updateCMSFields(\FieldList $fields)
{
if (!$this->owner->exists()) {
return;
}
$fields->addFieldsToTab('Root.Recommended', [\TextField::create('Recommended_Title', _t('Product.Recommended_Title', 'Title'))->setAttribute('placeholder', $this->owner->config()->recommended_title ?: _t('Product.Default-Recommended_Title', 'Recommended Products')), \CheckboxField::create('Recommended_AlsoBought', _t('Product.Recommended_AlsoBought', 'Prioritise products that were bought with this product?'))->setDescription(_t('Product.Desc-Recommended_AlsoBought', 'This will use products that previous customers have bought with this product, otherwise it will select from your choice below.')), \SelectionGroup::create('Recommended_FindBy', $this->getMethodFormFields())]);
}
示例4: __construct
public function __construct($controller, $name)
{
$product = new Product();
$title = new TextField('Title', _t('Product.PAGETITLE', 'Product Title'));
$urlSegment = new TextField('URLSegment', 'URL Segment');
$menuTitle = new TextField('MenuTitle', 'Navigation Title');
$sku = TextField::create('InternalItemID', _t('Product.CODE', 'Product Code/SKU'), '', 30);
$categories = DropdownField::create('ParentID', _t("Product.CATEGORY", "Category"), $product->categoryoptions())->setDescription(_t("Product.CATEGORYDESCRIPTION", "This is the parent page or default category."));
$otherCategories = ListBoxField::create('ProductCategories', _t("Product.ADDITIONALCATEGORIES", "Additional Categories"), ProductCategory::get()->filter("ID:not", $product->getAncestors()->map('ID', 'ID'))->map('ID', 'NestedTitle')->toArray())->setMultiple(true);
$model = TextField::create('Model', _t('Product.MODEL', 'Model'), '', 30);
$featured = CheckboxField::create('Featured', _t('Product.FEATURED', 'Featured Product'));
$allow_purchase = CheckboxField::create('AllowPurchase', _t('Product.ALLOWPURCHASE', 'Allow product to be purchased'), 1, 'Content');
$price = TextField::create('BasePrice', _t('Product.PRICE', 'Price'))->setDescription(_t('Product.PRICEDESC', "Base price to sell this product at."))->setMaxLength(12);
$image = UploadField::create('Image', _t('Product.IMAGE', 'Product Image'));
$content = new HtmlEditorField('Content', 'Content');
$fields = new FieldList();
$fields->add($title);
//$fields->add($urlSegment);
//$fields->add($menuTitle);
//$fields->add($sku);
$fields->add($categories);
//$fields->add($otherCategories);
$fields->add($model);
$fields->add($featured);
$fields->add($allow_purchase);
$fields->add($price);
$fields->add($image);
$fields->add($content);
//$fields = $product->getFrontEndFields();
$actions = new FieldList(new FormAction('submit', _t("ChefProductForm.ADDPRODUCT", 'Add product')));
$requiredFields = new RequiredFields(array('Title', 'Model', 'Price'));
parent::__construct($controller, $name, $fields, $actions, $requiredFields);
}
示例5: getDashletFields
public function getDashletFields()
{
$fields = parent::getDashletFields();
$fields->push(CheckboxField::create('ShowAnnouncements', 'Show general announcements'));
$fields->push(MultiValueTextField::create('RSSFeeds', 'RSS Feeds'));
return $fields;
}
示例6: getDefaultSearchContext
public function getDefaultSearchContext()
{
$context = parent::getDefaultSearchContext();
$fields = $context->getFields();
$fields->push(CheckboxField::create("HasBeenUsed"));
//add date range filtering
$fields->push(ToggleCompositeField::create("StartDate", "Start Date", array(DateField::create("q[StartDateFrom]", "From")->setConfig('showcalendar', true), DateField::create("q[StartDateTo]", "To")->setConfig('showcalendar', true))));
$fields->push(ToggleCompositeField::create("EndDate", "End Date", array(DateField::create("q[EndDateFrom]", "From")->setConfig('showcalendar', true), DateField::create("q[EndDateTo]", "To")->setConfig('showcalendar', true))));
//must be enabled in config, because some sites may have many products = slow load time, or memory maxes out
//future solution is using an ajaxified field
if (self::config()->filter_by_product) {
$fields->push(ListboxField::create("Products", "Products", Product::get()->map()->toArray())->setMultiple(true));
}
if (self::config()->filter_by_category) {
$fields->push(ListboxField::create("Categories", "Categories", ProductCategory::get()->map()->toArray())->setMultiple(true));
}
if ($field = $fields->fieldByName("Code")) {
$field->setDescription("This can be a partial match.");
}
//get the array, to maniplulate name, and fullname seperately
$filters = $context->getFilters();
$filters['StartDateFrom'] = GreaterThanOrEqualFilter::create('StartDate');
$filters['StartDateTo'] = LessThanOrEqualFilter::create('StartDate');
$filters['EndDateFrom'] = GreaterThanOrEqualFilter::create('EndDate');
$filters['EndDateTo'] = LessThanOrEqualFilter::create('EndDate');
$context->setFilters($filters);
return $context;
}
示例7: updateLinkForm
public function updateLinkForm(&$form)
{
$enabled = (int) $this->owner->request->getVar('lightbox');
$fields = $form->fields;
/* @var $fields FieldList */
$field = $fields->dataFieldByName('LinkType');
$options = $field->getSource();
if ($enabled) {
$options['lightbox'] = 'Lightbox';
} else {
// remove "anchor" for lightbox, since it's page specific
// TODO: perhaps move this to a separate flag?
unset($options['anchor']);
}
$field->setSource($options);
$fields->replaceField('LinkType', $field);
// add the list of lightboxes available
if ($enabled) {
$fields->insertAfter(LightboxAdmin::getLightboxField('lightbox', 'Lightbox'), 'internal');
$form->setFields($fields);
}
// also add an option to have the lightbox open by default
if ($enabled) {
$fields->insertAfter(CheckboxField::create('LightboxOpenByDefault', 'Lightbox open by default'), 'lightbox');
}
}
开发者ID:silverstripe-terraformers,项目名称:silverstripe-lightbox,代码行数:26,代码来源:HtmlEditorFieldLightExtension.php
示例8: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->removeByName(array('Lat', 'Lng'));
// Adds Lat/Lng fields for viewing in the CMS
$compositeField = CompositeField::create();
$compositeField->push($overrideField = CheckboxField::create('LatLngOverride', 'Override Latitude and Longitude?'));
$overrideField->setDescription('Check this box and save to be able to edit the latitude and longitude manually.');
if ($this->owner->Lng && $this->owner->Lat) {
$googleMapURL = 'http://maps.google.com/?q=' . $this->owner->Lat . ',' . $this->owner->Lng;
$googleMapDiv = '<div class="field"><label class="left" for="Form_EditForm_MapURL_Readonly">Google Map</label><div class="middleColumn"><a href="' . $googleMapURL . '" target="_blank">' . $googleMapURL . '</a></div></div>';
$compositeField->push(LiteralField::create('MapURL_Readonly', $googleMapDiv));
}
if ($this->owner->LatLngOverride) {
$compositeField->push(TextField::create('Lat', 'Lat'));
$compositeField->push(TextField::create('Lng', 'Lng'));
} else {
$compositeField->push(ReadonlyField::create('Lat_Readonly', 'Lat', $this->owner->Lat));
$compositeField->push(ReadonlyField::create('Lng_Readonly', 'Lng', $this->owner->Lng));
}
if ($this->owner->hasExtension('Addressable')) {
// If using addressable, put the fields with it
$fields->addFieldToTab('Root.Address', ToggleCompositeField::create('Coordinates', 'Coordinates', $compositeField));
} else {
if ($this->owner instanceof SiteTree) {
// If SIteTree but not using Addressable, put after 'Metadata' toggle composite field
$fields->insertAfter($compositeField, 'ExtraMeta');
} else {
$fields->addFieldToTab('Root.Main', ToggleCompositeField::create('Coordinates', 'Coordinates', $compositeField));
}
}
}
示例9: getCMSFields
public function getCMSFields()
{
$fields = FieldList::create(TextField::create('Title'), CheckboxField::create('PopularOnHomepage', 'Popular on homepage'), HtmlEditorField::create('Description'), $uploader = UploadField::create('Photo'));
$uploader->setFolderName('region-photos');
$uploader->getValidator()->setAllowedExtensions(array('png', 'gif', 'jpeg', 'jpg'));
return $fields;
}
示例10: __construct
public function __construct($controller, $name, $order)
{
/* Store Settings Object */
$conf = StoreSettings::get_settings();
/* Comments Box, if enabled */
if ($conf->CheckoutSettings_OrderComments) {
$comments = TextareaField::create("CustomerComments", "Order Comments");
$comments->setRightTitle("These comments will be seen by staff.");
} else {
$comments = HiddenField::create("CustomerComments", "");
}
/* Terms and Conditions, if enabled */
if ($conf->CheckoutSettings_TermsAndConditions) {
$terms = CheckboxField::create("Terms", "I agree to " . $conf->StoreSettings_StoreName . "'s " . "<a href=" . DataObject::get_by_id("SiteTree", $conf->CheckoutSettings_TermsAndConditionsSiteTree)->URLSegment . ">" . "Terms & Conditions</a>.");
} else {
$terms = HiddenField::create("Terms", "");
}
/* Fields */
$fields = FieldList::create($comments, OptionsetField::create("PaymentMethod", "Payment Method", Gateway::create()->getGateways($order)), $terms ? HeaderField::create("Terms and Conditions", 5) : HiddenField::create("TermsHeaderField", ""), $terms);
/* Actions */
$actions = FieldList::create(FormAction::create('payment', 'Place Order & Continue to Payment'));
/* Required Fields */
$required = new RequiredFields(array("PaymentMethod", $terms ? "Terms" : null));
/*
* Now we create the actual form with our fields and actions defined
* within this class.
*/
return parent::__construct($controller, $name, $fields, $actions, $required);
}
示例11: updateCMSFields
/**
* Adds our SEO Meta fields to the page field list
*
* @since version 1.0.0
*
* @param string $fields The current FieldList object
*
* @return object Return the FieldList object
**/
public function updateCMSFields(FieldList $fields)
{
$fields->removeByName('HeadTags');
$fields->removeByName('SitemapImages');
if (!$this->owner instanceof Page) {
$fields->addFieldToTab('Root.Page', HeaderField::create('Page'));
$fields->addFieldToTab('Root.Page', TextField::create('Title', 'Page name'));
}
$fields->addFieldToTab('Root.PageSEO', $this->preview());
$fields->addFieldToTab('Root.PageSEO', TextField::create('MetaTitle'));
$fields->addFieldToTab('Root.PageSEO', TextareaField::create('MetaDescription'));
$fields->addFieldToTab('Root.PageSEO', HeaderField::create(false, 'Indexing', 2));
$fields->addFieldToTab('Root.PageSEO', TextField::create('Canonical'));
$fields->addFieldToTab('Root.PageSEO', DropdownField::create('Robots', 'Robots', SEO_FieldValues::IndexRules()));
$fields->addFieldToTab('Root.PageSEO', NumericField::create('Priority'));
$fields->addFieldToTab('Root.PageSEO', DropdownField::create('ChangeFrequency', 'Change Frequency', SEO_FieldValues::SitemapChangeFrequency()));
$fields->addFieldToTab('Root.PageSEO', CheckboxField::create('SitemapHide', 'Hide in sitemap? (XML and HTML)'));
$fields->addFieldToTab('Root.PageSEO', HeaderField::create('Social Meta'));
$fields->addFieldToTab('Root.PageSEO', CheckboxField::create('HideSocial', 'Hide Social Meta?'));
$fields->addFieldToTab('Root.PageSEO', DropdownField::create('OGtype', 'Open Graph Type', SEO_FieldValues::OGtype()));
$fields->addFieldToTab('Root.PageSEO', DropdownField::create('OGlocale', 'Open Graph Locale', SEO_FieldValues::OGlocale()));
$fields->addFieldToTab('Root.PageSEO', DropdownField::create('TwitterCard', 'Twitter Card', SEO_FieldValues::TwitterCardTypes()));
$fields->addFieldToTab('Root.PageSEO', $this->SharingImage());
$fields->addFieldToTab('Root.PageSEO', HeaderField::create('Other Meta Tags'));
$fields->addFieldToTab('Root.PageSEO', $this->OtherHeadTags());
$fields->addFieldToTab('Root.PageSEO', HeaderField::create('Sitemap Images'));
$fields->addFieldToTab('Root.PageSEO', $this->SitemapImagesGrid());
$fields->addFieldToTab('Root.PageSEO', LiteralField::create(false, '<br><br>Silverstripe SEO v1.0'));
return $fields;
}
示例12: __construct
public function __construct($name, $title = null, $value = "")
{
// naming with underscores to prevent values from actually being saved somewhere
$this->fieldType = new OptionsetField("{$name}[Type]", _t('HtmlEditorField.LINKTO', 'Link to'), array('Internal' => _t('HtmlEditorField.LINKINTERNAL', 'Page on the site'), 'External' => _t('HtmlEditorField.LINKEXTERNAL', 'Another website'), 'Email' => _t('HtmlEditorField.LINKEMAIL', 'Email address'), 'File' => _t('HtmlEditorField.LINKFILE', 'Download a file')), 'Internal');
$this->fieldLink = new CompositeField($this->internalField = WTTreeDropdownField::create("{$name}[Internal]", _t('HtmlEditorField.Internal', 'Internal'), 'SiteTree', 'ID', 'Title', true), $this->externalField = TextField::create("{$name}[External]", _t('HtmlEditorField.URL', 'URL'), 'http://'), $this->emailField = EmailField::create("{$name}[Email]", _t('HtmlEditorField.EMAIL', 'Email address')), $this->fileField = WTTreeDropdownField::create("{$name}[File]", _t('HtmlEditorField.FILE', 'File'), 'File', 'ID', 'Title', true), $this->extraField = TextField::create("{$name}[Extra]", 'Extra(optional)')->setDescription('Appended to url. Use to add sub-urls/actions or query string to the url, e.g. ?param=value'), $this->anchorField = TextField::create("{$name}[Anchor]", 'Anchor (optional)'), $this->targetBlankField = CheckboxField::create("{$name}[TargetBlank]", _t('HtmlEditorField.LINKOPENNEWWIN', 'Open link in a new window?')));
if ($linkableDataObjects = WTLink::get_data_object_types()) {
if (!($objects = self::$linkable_data_objects)) {
$objects = array();
foreach ($linkableDataObjects as $className) {
$classObjects = array();
//set the format for DO value -> ClassName-ID
foreach (DataList::create($className) as $object) {
$classObjects[$className . '-' . $object->ID] = $object->Title;
}
if (!empty($classObjects)) {
$objects[singleton($className)->i18n_singular_name()] = $classObjects;
}
}
}
if (count($objects)) {
$this->fieldType->setSource(array_merge($this->fieldType->getSource(), array('DataObject' => _t('WTLinkField.LINKDATAOBJECT', 'Data Object'))));
$this->fieldLink->insertBefore("{$name}[Extra]", $this->dataObjectField = GroupedDropdownField::create("{$name}[DataObject]", _t('WTLinkField.LINKDATAOBJECT', 'Link to a Data Object'), $objects));
}
self::$linkable_data_objects = $objects;
}
$this->extraField->addExtraClass('no-hide');
$this->anchorField->addExtraClass('no-hide');
$this->targetBlankField->addExtraClass('no-hide');
parent::__construct($name, $title, $value);
}
示例13: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName(array('SortOrder', 'Pic', 'UID'));
$fields->addFieldsToTab('Root.Main', array(CheckboxField::create('Visible', _t('FacebookPost.VISIBLE', 'Is visible?')), DatetimeField_Readonly::create('Date', _t('FacebookPost.DATE', 'Posted on')), NumericField_Readonly::create('Likes', _t('FacebookPost.LIKES', 'Likes')), HtmlEditorField::create('Message', _t('FacebookPost.MESSAGE', 'Text'))->setRows(10)));
return $fields;
}
示例14: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeFieldFromTab('Root', 'Pages');
$fields->removeFieldsFromTab('Root.Main', array('SortOrder', 'showBlockbyClass', 'shownInClass', 'MemberVisibility'));
$fields->addFieldToTab('Root.Main', LiteralField::create('Status', 'Published: ' . $this->Published()), 'Title');
$memberGroups = Group::get();
$sourcemap = $memberGroups->map('Code', 'Title');
$source = array('anonymous' => 'Anonymous visitors');
foreach ($sourcemap as $mapping => $key) {
$source[$mapping] = $key;
}
$memberVisibility = new CheckboxSetField($name = "MemberVisibility", $title = "Show block for specific groups", $source);
$memberVisibility->setDescription('Show this block only for the selected group(s). If you select no groups, the block will be visible to all members.');
$availabelClasses = $this->availableClasses();
$inClass = new CheckboxSetField($name = "shownInClass", $title = "Show block for specific content types", $availabelClasses);
$filterSelector = OptionsetField::create('showBlockbyClass', 'Choose filter set', array('0' => 'by page', '1' => 'by page/data type'))->setDescription('<p><br /><strong>by page</strong>: block will be displayed in the selected page(s)<br /><strong>by page/data type</strong>: block will be displayed on the pages created with the particular page/data type. e.g. is <strong>"InternalPage"</strong> is picked, the block will be displayed, and will ONLY be displayed on all <strong>Internal Pages</strong></p>');
$availablePages = Page::get()->exclude('ClassName', array('ErrorPage', 'RedirectorPage', 'VirtualPage'));
$pageSelector = new CheckboxSetField($name = "Pages", $title = "Show on Page(s)", $availablePages->map('ID', 'Title'));
if ($this->canConfigPageAndType(Member::currentUser())) {
$fields->addFieldsToTab('Root.VisibilitySettings', array($filterSelector, $pageSelector, $inClass));
}
if ($this->canConfigMemberVisibility(Member::currentUser())) {
$fields->addFieldToTab('Root.VisibilitySettings', $memberVisibility);
}
if (!$fields->fieldByName('Options')) {
$fields->insertBefore($right = RightSidebar::create('Options'), 'Root');
}
$fields->addFieldsToTab('Options', array(CheckboxField::create('addMarginTop', 'add "margin-top" class to block wrapper'), CheckboxField::create('addMarginBottom', 'add "margin-bottom" class to block wrapper')));
return $fields;
}
示例15: getCMSFields
/**
* @return FieldSet
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.FormOptions', CheckboxField::create('ShowSubmittedList', 'Show the list of this user\'s submissions'));
$fields->addFieldToTab('Root.FormOptions', CheckboxField::create('ShowDraftList', 'Show the list of this user\'s draft submissions'));
$fields->addFieldToTab('Root.FormOptions', new CheckboxField('AllowEditingComplete', 'Allow "Complete" submissions to be re-edited'));
$fields->addFieldToTab('Root.FormOptions', new CheckboxField('ShowSubmitButton', 'Show the submit button - if not checked, forms will be "submitted" as soon as all required fields are complete'));
$fields->addFieldToTab('Root.FormOptions', new TextField('SubmitWarning', 'A warning to display to users when the submit button is clicked'));
$fields->addFieldToTab('Root.FormOptions', new CheckboxField('ShowPreviewButton', 'Show the buttons to preview the form'));
$fields->addFieldToTab('Root.FormOptions', new CheckboxField('ShowDeleteButton', 'Show the button to delete this form submission'));
$fields->addFieldToTab('Root.FormOptions', new CheckboxField('ShowButtonsOnTop', 'Show the form action buttons above the form as well as below'));
$fields->addFieldToTab('Root.FormOptions', new CheckboxField('LoadLastSubmission', 'Automatically load the latest incomplete submission when a user visits the form'));
$formFields = $this->Fields();
$options = array();
foreach ($formFields as $editableField) {
$options[$editableField->Name] = $editableField->Title;
}
$fields->addFieldToTab('Root.FormOptions', $df = DropdownField::create('SubmissionTitleField', 'Title field to use for new submissions', $options));
$df->setEmptyString('-- field --');
$df->setRightTitle('Useful if submissions are to be listed somewhere and a sort field is required');
if (class_exists('WorkflowDefinition')) {
$definitions = WorkflowDefinition::get()->map();
$field = DropdownField::create('WorkflowID', 'Submission workflow', $definitions)->setEmptyString('-- select a workflow --');
$field->setRightTitle('Workflow to use for making a submission complete');
$fields->addFieldToTab('Root.FormOptions', $field);
}
return $fields;
}