本文整理汇总了PHP中GridFieldConfig_RecordEditor::create方法的典型用法代码示例。如果您正苦于以下问题:PHP GridFieldConfig_RecordEditor::create方法的具体用法?PHP GridFieldConfig_RecordEditor::create怎么用?PHP GridFieldConfig_RecordEditor::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridFieldConfig_RecordEditor
的用法示例。
在下文中一共展示了GridFieldConfig_RecordEditor::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Contructor
* @param type $controller
* @param type $name
*/
function __construct($controller, $name)
{
//Administering calendars
if (CalendarConfig::subpackage_enabled('calendars')) {
//Configuration for calendar grid field
$gridCalendarConfig = GridFieldConfig_RecordEditor::create();
$gridCalendarConfig->removeComponentsByType('GridFieldDataColumns');
$gridCalendarConfig->addComponent($dataColumns = new GridFieldDataColumns(), 'GridFieldEditButton');
$c = singleton('Calendar');
$summaryFields = $c->summaryFields();
//$summaryFields = array(
// 'Title' => 'Title',
// //'SubscriptionOptIn' => 'Opt In',
// //'Shaded' => 'Shaded'
//);
$s = CalendarConfig::subpackage_settings('calendars');
//show shading info in the gridfield
if ($s['shading']) {
$summaryFields['Shaded'] = 'Shaded';
}
$dataColumns->setDisplayFields($summaryFields);
//settings for the case that colors are enabled
if ($s['colors']) {
$dataColumns->setFieldFormatting(array("Title" => '<div style=\\"height:20px;width:20px;display:inline-block;vertical-align:middle;margin-right:6px;background:$Color\\"></div> $Title'));
}
$GridFieldCalendars = new GridField('Calendars', '', PublicCalendar::get(), $gridCalendarConfig);
$fields = new FieldList($GridFieldCalendars);
$actions = new FieldList();
$this->addExtraClass('CalendarsForm');
parent::__construct($controller, $name, $fields, $actions);
}
}
示例2: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('Features');
$fields->removeByName('ExtraContent');
$regContent = $fields->dataFieldByName('RegistrationContent');
$afterContent = $fields->dataFieldByName('AfterRegistrationContent');
$profileContent = $fields->dataFieldByName('ProfileContent');
$regContent->addExtraClass('no-pagebreak');
$afterContent->addExtraClass('no-pagebreak');
$profileContent->addExtraClass('no-pagebreak');
$fields->insertAfter(TextareaField::create('ApprovalEmailTemplate', 'Approval Email Template'), 'EmailTemplate');
$fields->insertAfter(TextField::create('ApprovalEmailSubject', 'Approval Email Subject'), 'EmailTemplate');
$fields->insertAfter(TextareaField::create('ExpiryReminderEmailTemplate', 'Expiry Reminder Email Template'), 'ApprovalEmailTemplate');
$fields->insertAfter(TextField::create('ExpiryReminderEmailSubject', 'Expiry Reminder Email Subject'), 'ApprovalEmailTemplate');
$fields->insertAfter(TextareaField::create('ExpiryEmailTemplate', 'Expiry Email Template'), 'ExpiryReminderEmailTemplate');
$fields->insertAfter(TextField::create('ExpiryEmailSubject', 'Expiry Email Subject'), 'ExpiryReminderEmailTemplate');
$fields->addFieldToTab('Root.Members', LiteralField::create('MembersNote', '<p class="message"><strong>Note:</strong> This list has been filtered to include current and pending members only. Use the Members admin area for handling expired memberships and non-member website users.</p>'));
$members = Member::get()->exclude(array('MembershipStatus' => 'Not applied'))->exclude(array('MembershipStatus' => 'Expired'))->sort(array('ExpiryDate' => 'ASC'));
$gridField = new GridField('Members', 'NZLARP Members', $members, $config = GridFieldConfig_RecordEditor::create());
$gridField->setModelClass('Member');
$columns = $config->getComponentByType('GridFieldDataColumns');
$columns->setFieldFormatting(array('LastEdited' => function ($value, $item) {
return $item->LastEditedNice();
}));
$columns->setDisplayFields(array('getName' => 'Name', 'Region.Title' => 'Region', 'MembershipStatus' => 'Status', 'ExpiryDate' => 'Expires', 'LastEdited' => 'Last Activity'));
$fields->addFieldToTab('Root.Members', $gridField);
$config->getComponentByType('GridFieldPaginator')->setItemsPerPage(200);
return $fields;
}
示例3: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeFieldFromTab('Root.Main', 'Content', true);
$fields->addFieldsToTab('Root.Fields', array(new GridField('Fields', _t('MemberProfiles.PROFILEFIELDS', 'Account Fields'), $this->Fields(), $grid = GridFieldConfig_RecordEditor::create()->removeComponentsByType('GridFieldDeleteAction')->removeComponentsByType('GridFieldAddNewButton'))));
return $fields;
}
示例4: getModularCMSFields
function getModularCMSFields($relationName = 'Modules', $title = 'Content Modules')
{
$fields = array();
$GLOBALS['_CONTENT_MODULE_PARENT_PAGEID'] = $this->owner->ID;
$area = $this->owner->obj($relationName);
if ($area && $area->exists()) {
$fields[] = HeaderField::create($relationName . 'Header', $title, 2);
$fields[] = GridField::create($relationName, $title, $area->Modules(), GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldOrderableRows('SortOrder'))->removeComponentsByType('GridFieldAddNewButton')->addComponent($add = new GridFieldAddNewMultiClass()));
if (($allowed_modules = $this->owner->Config()->get('allowed_modules')) && is_array($allowed_modules) && count($allowed_modules)) {
if (isset($allowed_modules[$relationName])) {
$add->setClasses($allowed_modules[$relationName]);
} else {
$add->setClasses($allowed_modules);
}
} else {
// Remove the base "ContentModule" from allowed modules.
$classes = array_values(ClassInfo::subclassesFor('ContentModule'));
sort($classes);
if (($key = array_search('ContentModule', $classes)) !== false) {
unset($classes[$key]);
}
$add->setClasses($classes);
}
} else {
$fields[] = LiteralField::create('SaveFirstToAddModules', '<div class="message">You must save first before you can add modules.</div>');
}
return $fields;
}
示例5: getEditForm
public function getEditForm($id = null, $fields = null)
{
// TODO Duplicate record fetching (see parent implementation)
if (!$id) {
$id = $this->currentPageID();
}
$form = parent::getEditForm($id);
// TODO Duplicate record fetching (see parent implementation)
$record = $this->getRecord($id);
if ($record && !$record->canView()) {
return Security::permissionFailure($this);
}
$memberList = GridField::create('Members', false, Member::get(), $memberListConfig = GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldButtonRow('after'))->addComponent(new GridFieldExportButton('buttons-after-left')))->addExtraClass("members_grid");
if ($record && method_exists($record, 'getValidator')) {
$validator = $record->getValidator();
} else {
$validator = Injector::inst()->get('Member')->getValidator();
}
$memberListConfig->getComponentByType('GridFieldDetailForm')->setValidator($validator);
$groupList = GridField::create('Groups', false, Group::get(), GridFieldConfig_RecordEditor::create());
$columns = $groupList->getConfig()->getComponentByType('GridFieldDataColumns');
$columns->setDisplayFields(array('Breadcrumbs' => singleton('Group')->fieldLabel('Title')));
$columns->setFieldFormatting(array('Breadcrumbs' => function ($val, $item) {
return Convert::raw2xml($item->getBreadcrumbs(' > '));
}));
$fields = new FieldList($root = new TabSet('Root', $usersTab = new Tab('Users', _t('SecurityAdmin.Users', 'Users'), $memberList, new LiteralField('MembersCautionText', sprintf('<p class="caution-remove"><strong>%s</strong></p>', _t('SecurityAdmin.MemberListCaution', 'Caution: Removing members from this list will remove them from all groups and the' . ' database')))), $groupsTab = new Tab('Groups', singleton('Group')->i18n_plural_name(), $groupList)), new HiddenField('ID', false, 0));
// Add import capabilities. Limit to admin since the import logic can affect assigned permissions
if (Permission::check('ADMIN')) {
$fields->addFieldsToTab('Root.Users', array(new HeaderField(_t('SecurityAdmin.IMPORTUSERS', 'Import users'), 3), new LiteralField('MemberImportFormIframe', sprintf('<iframe src="%s" id="MemberImportFormIframe" width="100%%" height="250px" frameBorder="0">' . '</iframe>', $this->Link('memberimport')))));
$fields->addFieldsToTab('Root.Groups', array(new HeaderField(_t('SecurityAdmin.IMPORTGROUPS', 'Import groups'), 3), new LiteralField('GroupImportFormIframe', sprintf('<iframe src="%s" id="GroupImportFormIframe" width="100%%" height="250px" frameBorder="0">' . '</iframe>', $this->Link('groupimport')))));
}
// Tab nav in CMS is rendered through separate template
$root->setTemplate('CMSTabSet');
// Add roles editing interface
if (Permission::check('APPLY_ROLES')) {
$rolesField = GridField::create('Roles', false, PermissionRole::get(), GridFieldConfig_RecordEditor::create());
$rolesTab = $fields->findOrMakeTab('Root.Roles', _t('SecurityAdmin.TABROLES', 'Roles'));
$rolesTab->push($rolesField);
}
$actionParam = $this->getRequest()->param('Action');
if ($actionParam == 'groups') {
$groupsTab->addExtraClass('ui-state-active');
} elseif ($actionParam == 'users') {
$usersTab->addExtraClass('ui-state-active');
} elseif ($actionParam == 'roles') {
$rolesTab->addExtraClass('ui-state-active');
}
$actions = new FieldList();
$form = Form::create($this, 'EditForm', $fields, $actions)->setHTMLID('Form_EditForm');
$form->addExtraClass('cms-edit-form');
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
// Tab nav in CMS is rendered through separate template
if ($form->Fields()->hasTabset()) {
$form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
}
$form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses());
$form->setAttribute('data-pjax-fragment', 'CurrentForm');
$this->extend('updateEditForm', $form);
return $form;
}
示例6: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->insertBefore(TextareaField::create('Intro', 'Intro'), 'Content');
$fields->insertAfter(ColorPaletteField::create("Colour", "Colour", array('night' => '#333333', 'air' => '#009EE2', 'earth' => ' #79c608', 'passion' => '#b02635', 'people' => '#de347f', 'inspiration' => '#783980')), "Intro");
$fields->insertBefore($image = UploadField::create('SplashImage', 'Splash Image'), 'Content');
$image->setFolderName('Uploads/Splash-Images');
if ($this->ClassName === "Page" || $this->ClassName === "HomePage") {
$fields->insertAfter(HTMLEditorField::create('ExtraContent'), 'Content');
$gridField = new GridField('FeatureItems', 'FeatureItems', $this->FeatureItems()->sort(array('Sort' => 'ASC', 'Archived' => 'ASC')), $config = GridFieldConfig_RelationEditor::create());
$gridField->setModelClass('FeatureItem');
$fields->addFieldToTab('Root.Features', $gridField);
$config->addComponent(new GridFieldOrderableRows());
} else {
if ($this->ClassName === "CalendarPage") {
$content = $fields->dataFieldByName('Content');
$content->addExtraClass('no-pagebreak');
$events = Event::get()->sort(array('StartDateTime' => 'Desc'))->filterByCallback(function ($record) {
return !$record->getIsPastEvent();
});
$gridField = new GridField('Event', 'Upcoming Events', $events, $config = GridFieldConfig_RecordEditor::create());
$gridField->setModelClass('Event');
$dataColumns = $config->getComponentByType('GridFieldDataColumns');
$dataColumns->setDisplayFields(array('Title' => 'Title', 'StartDateTime' => 'Date and Time', 'DatesAndTimeframe' => 'Presentation String'));
$fields->addFieldToTab('Root.UpcomingEvents', $gridField);
}
}
return $fields;
}
示例7: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
// Payment Methods
$payment_table = GridField::create('PaymentMethods', _t("CheckoutAdmin.PaymentMethods", "Payment Methods"), $this->owner->PaymentMethods(), GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldAddNewButton('toolbar-header-right'), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(20), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm()));
// setup compressed payment options
$payment_fields = ToggleCompositeField::create('PaymentSettings', _t("CheckoutAdmin.Payments", "Payment Settings"), array(TextField::create('PaymentNumberPrefix', _t("CheckoutAdmin.OrderPrefix", "Add prefix to order numbers"), null, 9)->setAttribute("placeholder", _t("CheckoutAdmin.OrderPrefixPlaceholder", "EG 'abc'")), TextAreaField::create('PaymentSuccessContent', _t("CheckoutAdmin.PaymentSuccessContent", "Payment successfull content"))->setRows(4)->setColumns(30)->addExtraClass('stacked'), TextAreaField::create('PaymentFailerContent', _t("CheckoutAdmin.PaymentFailerContent", "Payment failer content"))->setRows(4)->setColumns(30)->addExtraClass('stacked'), $payment_table));
// Add html description of how to edit contries
$country_html = "<div class=\"field\">";
$country_html .= "<p>First select valid countries using the 2 character ";
$country_html .= "shortcode (see http://fasteri.com/list/2/short-names-of-countries-and-iso-3166-codes).</p>";
$country_html .= "<p>You can add multiple countries seperating them with";
$country_html .= "a comma or use a '*' for all countries.</p>";
$country_html .= "</div>";
$country_html_field = LiteralField::create("CountryDescription", $country_html);
// Deal with product features
$postage_field = new GridField('PostageAreas', '', $this->owner->PostageAreas(), GridFieldConfig::create()->addComponents(new GridFieldButtonRow('before'), new GridFieldToolbarHeader(), new GridFieldTitleHeader(), new GridFieldEditableColumns(), new GridFieldDeleteAction(), new GridFieldAddNewInlineButton('toolbar-header-left')));
// Add country dropdown to inline editing
$postage_field->getConfig()->getComponentByType('GridFieldEditableColumns')->setDisplayFields(array('Title' => array('title' => 'Title', 'field' => 'TextField'), 'Country' => array('title' => 'ISO 3166 codes', 'field' => 'TextField'), 'ZipCode' => array('title' => 'Zip/Post Codes', 'field' => 'TextField'), 'Calculation' => array('title' => 'Base unit', 'callback' => function ($record, $column, $grid) {
return DropdownField::create($column, "Based on", singleton('PostageArea')->dbObject('Calculation')->enumValues())->setValue("Weight");
}), 'Unit' => array('title' => 'Unit (equals or above)', 'field' => 'NumericField'), 'Cost' => array('title' => 'Cost', 'field' => 'NumericField'), 'Tax' => array('title' => 'Tax (percentage)', 'field' => 'NumericField')));
// Setup compressed postage options
$postage_fields = ToggleCompositeField::create('PostageFields', 'Postage Options', array($country_html_field, $postage_field));
// Setup compressed postage options
$discount_fields = ToggleCompositeField::create('DiscountFields', 'Discounts', array(GridField::create('Discounts', '', $this->owner->Discounts(), GridFieldConfig_RecordEditor::create())));
// Add config sets
$fields->addFieldToTab('Root.Checkout', $payment_fields);
$fields->addFieldToTab('Root.Checkout', $postage_fields);
$fields->addFieldToTab('Root.Checkout', $discount_fields);
}
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-checkout,代码行数:29,代码来源:CheckoutSiteConfigExtension.php
示例8: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
// TODO: Change the autogenerated stub
$fields->addFieldsToTab("Root.Regions", GridField::create('Regions', 'Regions on this page', $this->Regions(), GridFieldConfig_RecordEditor::create()));
return $fields;
}
示例9: updateCMSFields
/**
* @param FieldList $fields
* @return FieldList|void
*/
public function updateCMSFields(FieldList $fields)
{
$oldFields = $fields->toArray();
foreach ($oldFields as $field) {
$fields->remove($field);
}
$fields->push(new LiteralField("Title", "<h2>Training</h2>"));
$fields->push(new TextField("Name", "Name"));
$fields->push(new HtmlEditorField("Overview", "Overview"));
$fields->push(new CheckboxField("Active", "Active"));
$types = TrainingCourseType::get();
$levels = TrainingCourseLevel::get();
$companies = Company::get();
if ($companies) {
$fields->push(new DropdownField('CompanyID', 'Company', $companies->map("ID", "Name", "Please Select a Company")));
}
if ($types && $levels && $this->owner->ID > 0) {
$config = GridFieldConfig_RecordEditor::create();
$courses = new GridField('Courses', 'Courses', $this->owner->Courses(), $config);
$fields->push($courses);
} else {
$fields->push(new LiteralField("Warning", "** You can not add any Training Course until you create some Training Course Levels and Training Course Types!."));
}
return $fields;
}
示例10: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->insertAfter(new ToggleCompositeField('AfterRegistrationContent', _t('EventRegistration.AFTER_REG_CONTENT', 'After Registration Content'), array(new TextField('AfterRegTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterRegContent', _t('EventRegistration.CONTENT', 'Content')))), 'Content');
$fields->insertAfter(new ToggleCompositeField('AfterUnRegistrationContent', _t('EventRegistration.AFTER_UNREG_CONTENT', 'After Un-Registration Content'), array(new TextField('AfterUnregTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterUnregContent', _t('EventRegistration.CONTENT', 'Content')))), 'AfterRegistrationContent');
if ($this->RegEmailConfirm) {
$fields->addFieldToTab('Root.Main', new ToggleCompositeField('AfterRegistrationConfirmation', _t('EventRegistration.AFTER_REG_CONFIRM_CONTENT', 'After Registration Confirmation Content'), array(new TextField('AfterConfirmTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterConfirmContent', _t('EventRegistration.CONTENT', 'Content')))));
}
if ($this->UnRegEmailConfirm) {
$fields->addFieldToTab('Root.Main', new ToggleCompositeField('AfterUnRegistrationConfirmation', _t('EventRegistration.AFTER_UNREG_CONFIRM_CONTENT', 'After Un-Registration Confirmation Content'), array(new TextField('AfterConfUnregTitle', _t('EventRegistration.TITLE', 'Title')), new HtmlEditorField('AfterConfUnregContent', _t('EventRegistration.CONTENT', 'Content')))));
}
$fields->addFieldToTab('Root.Tickets', new GridField('Tickets', 'Ticket Types', $this->Tickets(), GridFieldConfig_RecordEditor::create()));
$generators = ClassInfo::implementorsOf('EventRegistrationTicketGenerator');
if ($generators) {
foreach ($generators as $generator) {
$instance = new $generator();
$generators[$generator] = $instance->getGeneratorTitle();
}
$generator = new DropdownField('TicketGenerator', _t('EventRegistration.TICKET_GENERATOR', 'Ticket generator'), $generators);
$generator->setEmptyString(_t('EventManagement.NONE', '(None)'));
$generator->setDescription(_t('EventManagement.TICKET_GENERATOR_NOTE', 'The ticket generator is used to generate a ticket file for the user to download.'));
$fields->addFieldToTab('Root.Tickets', $generator);
}
$regGridFieldConfig = GridFieldConfig_Base::create()->removeComponentsByType('GridFieldAddNewButton')->removeComponentsByType('GridFieldDeleteAction')->addComponents(new GridFieldButtonRow('after'), new GridFieldPrintButton('buttons-after-left'), new GridFieldExportButton('buttons-after-left'));
$fields->addFieldsToTab('Root.Registrations', array(new GridField('Registrations', _t('EventManagement.REGISTRATIONS', 'Registrations'), $this->DateTimes()->relation('Registrations')->filter('Status', 'Valid'), $regGridFieldConfig), new GridField('CanceledRegistrations', _t('EventManagement.CANCELLATIONS', 'Cancellations'), $this->DateTimes()->relation('Registrations')->filter('Status', 'Canceled'), $regGridFieldConfig)));
if ($this->RegEmailConfirm) {
$fields->addFieldToTab('Root.Registrations', new ToggleCompositeField('UnconfirmedRegistrations', _t('EventManagement.UNCONFIRMED_REGISTRATIONS', 'Unconfirmed Registrations'), array(new GridField('UnconfirmedRegistrations', '', $this->DateTimes()->relation('Registrations')->filter('Status', 'Unconfirmed')))));
}
$fields->addFieldToTab('Root.Invitations', new GridField('Invitations', _t('EventManagement.INVITATIONS', 'Invitations'), $this->Invitations(), GridFieldConfig_RecordViewer::create()->addComponent(new GridFieldButtonRow('before'))->addComponent(new EventSendInvitationsButton($this))));
return $fields;
}
示例11: getCMSFields
public function getCMSFields()
{
$fields = new FieldList(new TabSet('Root'));
// Details
$thumbnailField = new UploadField('CoverImage', _t('ImageGalleryAlbum.COVERIMAGE', 'Cover Image'));
$thumbnailField->getValidator()->setAllowedExtensions(File::config()->app_categories['image']);
$fields->addFieldsToTab('Root.Main', array(new TextField('AlbumName', _t('ImageGalleryAlbum.ALBUMTITLE', 'Album Title'), null, 255), new TextareaField('Description', _t('ImageGalleryAlbum.DESCRIPTION', 'Description')), $thumbnailField));
// Image listing
$galleryConfig = GridFieldConfig_RecordEditor::create();
// Enable bulk image loading if necessary module is installed
// @see composer.json/suggests
if (class_exists('GridFieldBulkManager')) {
$galleryConfig->addComponent(new GridFieldBulkManager());
}
if (class_exists('GridFieldBulkImageUpload')) {
$galleryConfig->addComponents($imageConfig = new GridFieldBulkImageUpload('ImageID'));
$imageConfig->setConfig('fieldsClassBlacklist', array('ImageField', 'UploadField', 'FileField'));
if ($uploadFolder = $this->Folder()) {
// Set upload folder - Clean up 'assets' from target path
$path = preg_replace('/(^' . ASSETS_DIR . '\\/?)|(\\/$)/i', '', $uploadFolder->RelativePath);
$imageConfig->setConfig('folderName', $path);
}
}
// Enable image sorting if necessary module is installed
// @see composer.json/suggests
if (class_exists('GridFieldSortableRows')) {
$galleryConfig->addComponent(new GridFieldSortableRows('SortOrder'));
}
$galleryField = new GridField('GalleryItems', 'Gallery Items', $this->GalleryItems(), $galleryConfig);
$fields->addFieldToTab('Root.Images', $galleryField);
return $fields;
}
示例12: getCMSFields
public function getCMSFields()
{
$self = $this;
$this->beforeUpdateCMSFields(function ($f) use($self) {
Requirements::javascript('event_calendar/javascript/calendar_cms.js');
$f->addFieldToTab("Root.Main", TextField::create("Location", _t('Calendar.LOCATIONDESCRIPTION', 'The location for this event')), 'Content');
$dt = _t('CalendarEvent.DATESANDTIMES', 'Dates and Times');
$recursion = _t('CalendarEvent.RECURSION', 'Recursion');
$f->addFieldToTab("Root.{$dt}", GridField::create("DateTimes", _t('Calendar.DATETIMEDESCRIPTION', 'Add dates for this event'), $self->DateTimes(), GridFieldConfig_RecordEditor::create()));
$f->addFieldsToTab("Root.{$recursion}", array(new CheckboxField('Recursion', _t('CalendarEvent.REPEATEVENT', 'Repeat this event')), new OptionsetField('CustomRecursionType', _t('CalendarEvent.DESCRIBEINTERVAL', 'Describe the interval at which this event recurs.'), array('1' => _t('CalendarEvent.DAILY', 'Daily'), '2' => _t('CalendarEvent.WEEKLY', 'Weekly'), '3' => _t('CalendarEvent.MONTHLY', 'Monthly')))));
$f->addFieldToTab("Root.{$recursion}", $dailyInterval = new FieldGroup(new LabelField($name = "every1", $title = _t("CalendarEvent.EVERY", "Every ")), new DropdownField('DailyInterval', '', array_combine(range(1, 10), range(1, 10))), new LabelField($name = "days", $title = _t("CalendarEvent.DAYS", " day(s)"))));
$f->addFieldToTab("Root.{$recursion}", $weeklyInterval = new FieldGroup(new LabelField($name = "every2", $title = _t("CalendarEvent.EVERY", "Every ")), new DropdownField('WeeklyInterval', '', array_combine(range(1, 10), range(1, 10))), new LabelField($name = "weeks", $title = _t("CalendarEvent.WEEKS", " weeks"))));
$f->addFieldToTab("Root.{$recursion}", new CheckboxSetField('RecurringDaysOfWeek', _t('CalendarEvent.ONFOLLOWINGDAYS', 'On the following day(s)...'), DataList::create("RecurringDayOfWeek")->map("ID", "Title")));
$f->addFieldToTab("Root.{$recursion}", $monthlyInterval = new FieldGroup(new LabelField($name = "every3", $title = _t("CalendarEvent.EVERY", "Every ")), new DropdownField('MonthlyInterval', '', array_combine(range(1, 10), range(1, 10))), new LabelField($name = "months", $title = _t("CalendarEvent.MONTHS", " month(s)"))));
$f->addFieldsToTab("Root.{$recursion}", array(new OptionsetField('MonthlyRecursionType1', '', array('1' => _t('CalendarEvent.ONTHESEDATES', 'On these date(s)...'))), new CheckboxSetField('RecurringDaysOfMonth', '', DataList::create("RecurringDayOfMonth")->map("ID", "Value")), new OptionsetField('MonthlyRecursionType2', '', array('1' => _t('CalendarEvent.ONTHE', 'On the...')))));
$f->addFieldToTab("Root.{$recursion}", $monthlyIndex = new FieldGroup(new DropdownField('MonthlyIndex', '', array('1' => _t('CalendarEvent.FIRST', 'First'), '2' => _t('CalendarEvent.SECOND', 'Second'), '3' => _t('CalendarEvent.THIRD', 'Third'), '4' => _t('CalendarEvent.FOURTH', 'Fourth'), '5' => _t('CalendarEvent.LAST', 'Last'))), new DropdownField('MonthlyDayOfWeek', '', DataList::create("RecurringDayOfWeek")->map("Value", "Title")), new LabelField($name = "ofthemonth", $title = _t("CalendarEvent.OFTHEMONTH", " of the month."))));
$f->addFieldToTab("Root.{$recursion}", GridField::create("Exceptions", _t('CalendarEvent.ANYEXCEPTIONS', 'Any exceptions to this pattern? Add the dates below.'), $self->Exceptions(), GridFieldConfig_RecordEditor::create()));
$dailyInterval->addExtraClass('dailyinterval');
$weeklyInterval->addExtraClass('weeklyinterval');
$monthlyInterval->addExtraClass('monthlyinterval');
$monthlyIndex->addExtraClass('monthlyindex');
});
$f = parent::getCMSFields();
return $f;
}
示例13: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.EnquiryForm', HeaderField::create('Enquiry Form Setup', 2));
$gridFieldConfig = GridFieldConfig_RecordEditor::create(100);
$gridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));
/* Unset field-sorting hack */
$gridFieldConfig->getComponentByType('GridFieldSortableHeader')->setFieldSorting(array('FieldName' => 'FieldNameNoSorting', 'FieldType' => 'FieldTypeNoSorting'));
$gridField = GridField::create('EnquiryFormFields', false, $this->EnquiryFormFields(), $gridFieldConfig);
$fields->addFieldToTab('Root.EnquiryForm', $gridField);
$email_settings = array(EmailField::create('EmailTo', 'Send email to'), EmailField::create('EmailFrom', 'Send email from')->setRightTitle('For example website@yourdomain.com'), TextField::create('EmailSubject', 'Email subject'), HeaderField::create('Message on website once completed', 5), HTMLEditorField::create('EmailSubmitCompletion', '')->setRows(10), EmailField::create('EmailBcc', 'Send BCC copy to (optional)')->setRightTitle('If you would like a copy of the enquiry to be sent elsewhere, fill that in here.'), TextField::create('EmailSubmitButtonText', 'Submit button text'));
$toggleSettings = ToggleCompositeField::create('FormSettings', 'Enquiry Form Settings', $email_settings);
$fields->addFieldsToTab('Root.EnquiryForm', $toggleSettings);
$spam_settings = array();
array_push($spam_settings, DropdownField::create('AddCaptcha', 'Add captcha image (optional)', array(0 => 'No', 1 => 'Yes'))->setRightTitle('You can optionally enable an anti-spam "captcha" image.
This adds a small image with 4 random numbers which needs to be filled in correctly.'));
if (!$this->CaptchaText) {
$this->CaptchaText = 'Verification Image';
}
array_push($spam_settings, TextField::create('CaptchaText', 'Field name'));
array_push($spam_settings, TextField::create('CaptchaHelp', 'Captcha help (optional)')->setRightTitle('If you would like to explain what the captcha is, please explain briefly what it is.
This is only used if you have selected to add the captcha image.'));
$toggleSpam = ToggleCompositeField::create('SpamSettings', 'Anti-Spam Settings', $spam_settings);
$fields->addFieldsToTab('Root.EnquiryForm', $toggleSpam);
return $fields;
}
示例14: getCMSFields
/**
* Get CMS fields
*
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName('TeamMembers');
$fields->addFieldToTab('Root.Main', GridField::create('TeamMembers', 'Team Members', $this->TeamMembers(), GridFieldConfig_RecordEditor::create()->addComponent(new GridFieldSortableRows('SortOrder'))));
return $fields;
}
示例15: getCMSFields
function getCMSFields()
{
$fields = parent::getCMSFields();
$biosTable = new GridField('Bio', 'Bio', $this->Bios(), GridFieldConfig_RecordEditor::create());
$fields->addFieldToTab('Root.Bios', $biosTable);
return $fields;
}