当前位置: 首页>>代码示例>>PHP>>正文


PHP GridFieldConfig类代码示例

本文整理汇总了PHP中GridFieldConfig的典型用法代码示例。如果您正苦于以下问题:PHP GridFieldConfig类的具体用法?PHP GridFieldConfig怎么用?PHP GridFieldConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GridFieldConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($controller, $name, $show_actions = true)
 {
     $TempBasketID = Store_BasketController::get_temp_basket_id();
     $order_id = DB::Query("SELECT id FROM `order` WHERE (`TempBasketID`='" . $TempBasketID . "')")->value();
     /* Basket GridField */
     $config = new GridFieldConfig();
     $dataColumns = new GridFieldDataColumns();
     $dataColumns->setDisplayFields(array('getPhoto' => "Photo", 'Title' => 'Product', 'Price' => 'Item Price', 'Quantity' => 'Quantity', 'productPrice' => 'Total Price', 'getfriendlyTaxCalculation' => 'Tax Inc/Exc', 'TaxClassName' => 'Tax'));
     $config->addComponent($dataColumns);
     $config->addComponent(new GridFieldTitleHeader());
     $basket = GridField::create("BasketItems", "", DataObject::get("Order_Items", "(OrderID='" . $order_id . "')"), $config);
     /* Basket Subtotal */
     $subtotal = new Order();
     $subtotal = $subtotal->calculateSubTotal($order_id);
     $subtotal = ReadonlyField::create("SubTotal", "Basket Total (" . Product::getDefaultCurrency() . ")", $subtotal);
     /* Fields */
     $fields = FieldList::create($basket, $subtotal, ReadonlyField::create("Tax", "Tax", "Calculated on the Order Summary page."));
     /* Actions */
     $actions = FieldList::create(CompositeField::create(FormAction::create('continueshopping', 'Continue Shopping'), FormAction::create('placeorder', 'Place Order')));
     /* Required Fields */
     $required = new RequiredFields(array());
     /*
      * Now we create the actual form with our fields and actions defined 
      * within this class.
      */
     return parent::__construct($controller, $name, $fields, $show_actions ? $actions : FieldList::create(), $required);
 }
开发者ID:micschk,项目名称:torindul-silverstripe-shop,代码行数:27,代码来源:BasketForm.php

示例2: getCMSFields

 /**
  * @return FieldList
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('Values');
     $values = new GridField("Values", "SubmittedFormField", $this->Values()->sort('Created', 'ASC'));
     $config = new GridFieldConfig();
     $config->addComponent(new GridFieldDataColumns());
     $config->addComponent(new GridFieldExportButton());
     $config->addComponent(new GridFieldPrintButton());
     $values->setConfig($config);
     $fields->addFieldToTab('Root.Main', $values);
     return $fields;
 }
开发者ID:vinstah,项目名称:body,代码行数:16,代码来源:SubmittedForm.php

示例3: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $staff_config = GridFieldConfig::create()->addComponents(new GridFieldSortableRows('SortOrder'), new GridFieldToolbarHeader(), new GridFieldAddNewButton('toolbar-header-right'), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(10), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm());
     $fields->addFieldToTab('Root.Content.StaffMembers', new GridField('StaffMembers', 'Staff Members', $this->StaffMembers(), $staff_config));
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:iqnection-pages-staffpage,代码行数:7,代码来源:StaffPage.php

示例4: updateCMSFields

 function updateCMSFields(FieldList $fields)
 {
     //prevent certain pages from having a Document tab in the CMS
     if (in_array($this->owner->ClassName, self::$noDocumentsList)) {
         return;
     }
     //javascript to customize the grid field for the DMS document (overriding entwine in FRAMEWORK_DIR.'/javascript/GridField.js'
     Requirements::javascript(DMS_DIR . '/javascript/DMSGridField.js');
     Requirements::css(DMS_DIR . '/css/DMSMainCMS.css');
     //javascript for the link editor pop-up in TinyMCE
     Requirements::javascript(DMS_DIR . "/javascript/DocumentHtmlEditorFieldToolbar.js");
     // Document listing
     $gridFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldFilterHeader(), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldEditButton(), new DMSGridFieldDeleteAction(), new GridFieldDetailForm());
     if (class_exists('GridFieldPaginatorWithShowAll')) {
         $paginatorComponent = new GridFieldPaginatorWithShowAll(15);
     } else {
         $paginatorComponent = new GridFieldPaginator(15);
     }
     $gridFieldConfig->addComponent($paginatorComponent);
     if (class_exists('GridFieldSortableRows')) {
         $sortableComponent = new GridFieldSortableRows('DocumentSort');
         $sortableComponent->setUsePagination(false)->setForceRedraw(true);
         $gridFieldConfig->addComponent($sortableComponent);
     }
     // HACK: Create a singleton of DMSDocument to ensure extensions are applied before we try to get display fields.
     singleton('DMSDocument');
     $gridFieldConfig->getComponentByType('GridFieldDataColumns')->setDisplayFields(Config::inst()->get('DMSDocument', 'display_fields'))->setFieldCasting(array('LastChanged' => "Datetime->Ago"))->setFieldFormatting(array('FilenameWithoutID' => '<a target=\'_blank\' class=\'file-url\' href=\'$Link\'>$FilenameWithoutID</a>'));
     //override delete functionality with this class
     $gridFieldConfig->getComponentByType('GridFieldDetailForm')->setItemRequestClass('DMSGridFieldDetailForm_ItemRequest');
     $gridField = GridField::create('Documents', false, $this->owner->Documents()->Sort('DocumentSort'), $gridFieldConfig);
     $gridField->addExtraClass('documents');
     $uploadBtn = new LiteralField('UploadButton', sprintf('<a class="ss-ui-button ss-ui-action-constructive cms-panel-link" data-pjax-target="Content" data-icon="add" href="%s">%s</a>', Controller::join_links(singleton('DMSDocumentAddController')->Link(), '?ID=' . $this->owner->ID), "Add Documents"));
     $fields->addFieldsToTab('Root.Documents (' . $this->owner->Documents()->Count() . ')', array($uploadBtn, $gridField));
 }
开发者ID:nyeholt,项目名称:silverstripe-dms,代码行数:34,代码来源:DMSSiteTreeExtension.php

示例5: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Hide the calendar locations tab
     $fields->removeByName('Locations');
     // Use the time picker field
     $fields->addFieldToTab('Root.Main', new TimePickerField('StartTime'), 'Description');
     $fields->addFieldToTab('Root.Main', new TimePickerField('EndTime'), 'Description');
     // Add a private flag
     $fields->addFieldToTab('Root.Main', new CheckboxField('Private', 'Private Booking'), 'Description');
     // Add the locations
     $fields->addFieldToTab('Root.Main', new CheckboxSetField('Locations', 'Locations', CalendarLocation::get()->map('ID', 'Name')), 'Description');
     // Create a default configuration for the new GridField, allowing record deletion
     $config = GridFieldConfig::create();
     $config->addComponent(new GridFieldButtonRow('before'));
     $config->addComponent(new GridFieldToolbarHeader());
     $config->addComponent(new GridFieldEditableColumns());
     $config->addComponent(new GridFieldDeleteAction());
     $config->addComponent(new GridFieldAddNewInlineButton());
     // Create a gridfield to hold the dates
     $externalLinksGridField = new GridField('CalendarEventDatesGrid', 'Dates', $this->CalendarEventDates(), $config);
     $fields->addFieldToTab('Root.Main', $externalLinksGridField, 'Description');
     // Hide the calendar event date tab
     $fields->removeByName('CalendarEventDates');
     return $fields;
 }
开发者ID:pmachapman,项目名称:rcpn.org.nz,代码行数:26,代码来源:CalendarEvent.php

示例6: 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

示例7: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('LinkedFromCities');
     $grid = new GridField('LinkedToCities', $this->fieldLabel('LinkedToCities'), $this->LinkedToCities(), GridFieldConfig::create()->addComponent(new GridFieldDetailForm())->addComponent(new GridFieldButtonRow())->addComponent($GridFieldAddExistingSearchButton = new GridFieldAddExistingSearchButton('buttons-before-right'))->addComponent($GridFieldAddExistingAutocompleter = new GridFieldAddExistingAutocompleter('buttons-before-right'))->addComponent(new GridFieldToolbarHeader())->addComponent(new GridFieldTitleHeader())->addComponent($comp = new GridFieldEditableColumns())->addComponent(new GridFieldEditButton())->addComponent(new GridFieldDeleteAction('unlinkrelation'))->addComponent(new GridFieldDeleteAction())->addComponent($GridFieldAddNewInlineButton = new GridFieldAddNewInlineButton()));
     $GridFieldAddNewInlineButton->setTitle(_t(__CLASS__ . '.AddNewCity', 'Add new city'));
     $GridFieldAddExistingSearchButton->setTitle(_t(__CLASS__ . '.SearchAndAddExistingCity', 'Search and add existing city'));
     $LinkTargetField = MapaelCountryPageExtension::getTargetField($this, 'LinkTarget');
     $LinkTargetField->setTitle(_t(__CLASS__ . '.LinkTarget', 'Link target'));
     $field_names = array_keys(array_merge($this->summaryFields(), self::$many_many_extraFields['LinkedToCities']));
     $arr = array();
     foreach ($field_names as $name) {
         preg_match('/(TooltipContent|Href|Target)$/', $name, $matches);
         $title = $this->fieldLabel($name);
         $arr[$name] = $title;
         if ($matches) {
             $arr[$name] = array('title' => $title, 'callback' => function ($record, $column, $grid) {
                 preg_match('/(TooltipContent|Href|Target)$/', $column, $matches);
                 return MapaelCountryPageExtension::getAttrField($record, $matches[1], $column);
             });
         }
     }
     $comp->setDisplayFields($arr);
     $fields->replaceField('LinkedToCities', $grid);
     $fields->replaceField('Target', MapaelCountryPageExtension::getTargetField($this));
     $fields->replaceField('Href', MapaelCountryPageExtension::getHrefField($this));
     $fields->replaceField('TooltipContent', MapaelCountryPageExtension::getTooltipContentField($this));
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:plishkin-ss-mapael,代码行数:29,代码来源:MapaelCity.php

示例8: getCMSFields

 function getCMSFields()
 {
     if ($this->ID != 0) {
         $totalCount = $this->getTotalVotes();
     } else {
         $totalCount = 0;
     }
     $fields = new FieldList($rootTab = new TabSet("Root", new Tab("Main", new TextField('Title', 'Poll title (maximum 50 characters)', null, 50), new OptionsetField('MultiChoice', 'Single answer (radio buttons)/multi-choice answer (tick boxes)', array(0 => 'Single answer', 1 => 'Multi-choice answer')), new OptionsetField('IsActive', 'Poll state', array(1 => 'Active', 0 => 'Inactive')), $embargo = new DatetimeField('Embargo', 'Embargo'), $expiry = new DatetimeField('Expiry', 'Expiry'), new HTMLEditorField('Description', 'Description'))));
     $embargo->getDateField()->setConfig('showcalendar', true);
     $embargo->getTimeField()->setConfig('showdropdown', true);
     $embargo->getDateField()->setConfig('dateformat', 'dd/MM/YYYY');
     $embargo->getTimeField()->setConfig('timeformat', 'h:m a');
     $expiry->getDateField()->setConfig('showcalendar', true);
     $expiry->getTimeField()->setConfig('showdropdown', true);
     $expiry->getDateField()->setConfig('dateformat', 'dd/MM/YYYY');
     $expiry->getTimeField()->setConfig('timeformat', 'h:m a');
     // Add the fields that depend on the poll being already saved and having an ID
     if ($this->ID != 0) {
         $config = GridFieldConfig::create();
         $config->addComponent(new GridFieldToolbarHeader());
         $config->addComponent(new GridFieldAddNewButton('toolbar-header-right'));
         $config->addComponent(new GridFieldDataColumns());
         $config->addComponent(new GridFieldEditButton());
         $config->addComponent(new GridFieldDeleteAction());
         $config->addComponent(new GridFieldDetailForm());
         $config->addComponent(new GridFieldSortableHeader());
         $pollChoicesTable = new GridField('Choices', 'Choices', $this->Choices(), $config);
         $fields->addFieldToTab('Root.Data', $pollChoicesTable);
         $fields->addFieldToTab('Root.Data', new ReadonlyField('Total', 'Total votes', $totalCount));
     } else {
         $fields->addFieldToTab('Root.Choices', new ReadOnlyField('ChoicesPlaceholder', 'Choices', 'You will be able to add options once you have saved the poll for the first time.'));
     }
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
开发者ID:peavers,项目名称:silverstripe-polls,代码行数:35,代码来源:Poll.php

示例9: tasklist

 public function tasklist()
 {
     $gridFieldConfig = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(5), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm());
     $fields = new FieldList($gridField = new GridField('TaskGrid', 'Example grid', new DataList('Task'), $gridFieldConfig));
     $actions = new FieldList();
     return new Form($this, 'tasklist', $fields, $actions);
 }
开发者ID:micschk,项目名称:SilverProject,代码行数:7,代码来源:TaskPage.php

示例10: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('Capacity');
     $fields->removeByName('Registrations');
     $fields->removeByName('Tickets');
     $fields->removeByName('EmailReminder');
     $fields->removeByName('RemindDays');
     $fields->removeByName('PaymentID');
     $fields->removeByName('ReminderJobID');
     if (!$this->isInDB()) {
         $fields->push(new LiteralField('RegistrationNote', '<p>You can configure registration once ' . 'you save for the first time.</p>'));
         return $fields;
     }
     $fields->push(new GridField('Tickets', _t('EventManagement.AVAILABLE_TICKETS', 'Available Tickets'), $this->Tickets(), GridFieldConfig::create()->addComponent(new GridFieldButtonRow('before'))->addComponent(new GridFieldToolbarHeader())->addComponent($add = new GridFieldAddExistingSearchButton())->addComponent(new GridFieldTitleHeader())->addComponent(new GridFieldOrderableRows('Sort'))->addComponent($editable = new GridFieldEditableColumns())->addComponent(new GridFieldDeleteAction(true))));
     $fields->push($capacity = new NumericField('Capacity', _t('EventManagement.CAPACITY', 'Capacity')));
     $editable->setDisplayFields(array('Title' => array('title' => 'Title', 'field' => 'ReadonlyField'), 'StartSummary' => 'Sales Start', 'PriceSummary' => 'Price', 'Available' => array('field' => 'NumericField')));
     $add->setTitle(_t('EventManagement.ADD_TICKET_TYPE', 'Add Ticket Type'));
     $capacity->setDescription('Set to 0 for unlimited capacity.');
     if (class_exists('AbstractQueuedJob')) {
         if ($this->ReminderJobID && $this->ReminderJob()->StepsProcessed) {
             $fields->push(new LiteralField('RemindersAlreadySent', '<p>Reminder emails have already been sent out.</p>'));
         } else {
             $fields->push(new CheckboxField('EmailReminder', _t('EventManagement.SEND_REMINDER_EMAIL', 'Send the registered attendees a reminder email?')));
             $fields->push($remindDays = new NumericField('RemindDays', _t('EventManagement.SEND_REMINDER', 'Send reminder')));
             $remindDays->setDescription(_t('EventManagement.DAYS_BEFORE_EVENT', 'Days before the event starts.'));
         }
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:ajshort-silverstripe-eventmanagement,代码行数:30,代码来源:RegistrableDateTime.php

示例11: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     // check if the insertbefore field is present (may be added later, in which case the above
     // fields never get added
     //$insertOnTab = $this->owner->getFilterableArchiveConfigValue('pagination_control_tab');
     //$insertBefore = $this->owner->getFilterableArchiveConfigValue('pagination_insert_before');
     $insertOnTab = Config::inst()->get($this->owner->className, 'pagination_control_tab');
     $insertBefore = Config::inst()->get($this->owner->className, 'pagination_insert_before');
     if (!$fields->fieldByName("{$insertOnTab}.{$insertBefore}")) {
         $insertBefore = null;
     }
     //if($this->owner->getFilterableArchiveConfigValue('datearchive_active')){
     if (Config::inst()->get($this->owner->className, 'datearchive_active')) {
         //$fields->addFieldToTab($this->owner->getFilterableArchiveConfigValue('pagination_control_tab'),
         $fields->addFieldToTab(Config::inst()->get($this->owner->className, 'pagination_control_tab'), DropdownField::create('ArchiveUnit', _t('filterablearchive.ARCHIVEUNIT', 'Archive unit'), array('year' => _t('filterablearchive.YEAR', 'Year'), 'month' => _t('filterablearchive.MONTH', 'Month'), 'day' => _t('filterablearchive.DAY', 'Day'))), $insertBefore);
     }
     $pagerField = NumericField::create("ItemsPerPage", _t("filterablearchive.ItemsPerPage", "Pagination: items per page"))->setRightTitle(_t("filterablearchive.LeaveEmptyForNone", "Leave empty or '0' for no pagination"));
     $fields->addFieldToTab($insertOnTab, $pagerField, $insertBefore);
     //
     // Create categories and tag config
     //
     //		$config = GridFieldConfig_RecordEditor::create();
     //		$config->removeComponentsByType("GridFieldAddNewButton");
     //		$config->addComponent(new GridFieldAddByDBField("buttons-before-left"));
     // Lets just use what others have made already...
     $config = GridFieldConfig::create()->addComponent(new GridFieldButtonRow('before'))->addComponent(new GridFieldToolbarHeader())->addComponent(new GridFieldTitleHeader())->addComponent(new GridFieldEditableColumns())->addComponent(new GridFieldDeleteAction())->addComponent(new GridFieldAddNewInlineButton('toolbar-header-right'));
     //if($this->owner->getFilterableArchiveConfigValue('categories_active')){
     if (Config::inst()->get($this->owner->className, 'categories_active')) {
         $fields->addFieldToTab($insertOnTab, $categories = GridField::create("Categories", _t("FilterableArchive.Categories", "Categories"), $this->owner->Categories(), $config), $insertBefore);
     }
     //if($this->owner->getFilterableArchiveConfigValue('tags_active')){
     if (Config::inst()->get($this->owner->className, 'tags_active')) {
         $fields->addFieldToTab($insertOnTab, $tags = GridField::create("Tags", _t("FilterableArchive.Tags", "Tags"), $this->owner->Tags(), $config), $insertBefore);
     }
 }
开发者ID:helpfulrobot,项目名称:micschk-silverstripe-filterablearchive,代码行数:35,代码来源:FilterableArchiveHolderExtension.php

示例12: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     // Add config sets
     $fields->addFieldToTab('Root.Catalogue', UploadField::create('DefaultProductImage', _t("Catalogue.DefaultProductImage", 'Default product image')));
     // Add config sets
     $fields->addFieldToTab('Root.Catalogue', GridField::create('TaxRates', _t("Catalogue.TaxRates", "Tax Rates"), TaxRate::get(), GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldAddNewButton('toolbar-header-right'), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(5), new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm())));
 }
开发者ID:i-lateral,项目名称:silverstripe-catalogue,代码行数:7,代码来源:CatalogueSiteConfigExtension.php

示例13: setUp

	public function setUp() {
		parent::setUp();
		$this->list = new DataList('GridFieldAction_Edit_Team');
		$config = GridFieldConfig::create()->addComponent(new GridFieldEditButton());
		$this->gridField = new GridField('testfield', 'testfield', $this->list, $config);
		$this->form = new Form(new Controller(), 'mockform', new FieldList(array($this->gridField)), new FieldList());
	}
开发者ID:redema,项目名称:sapphire,代码行数:7,代码来源:GridFieldEditButtonTest.php

示例14: Form

 public function Form()
 {
     $player = DataObject::get('GridFieldTest_Player')->find('Email', 'player1@test.com');
     $config = GridFieldConfig::create()->addComponents($relationComponent = new GridFieldAddExistingAutocompleter('before', 'Name'), new GridFieldDataColumns());
     $field = new GridField('testfield', 'testfield', $player->Teams(), $config);
     return new Form($this, 'Form', new FieldList($field), new FieldList());
 }
开发者ID:normann,项目名称:sapphire,代码行数:7,代码来源:GridFieldAddExistingAutocompleterTest.php

示例15: getCMSFields

 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // Create a default configuration for the new GridField, allowing record deletion
     $config = GridFieldConfig_RecordEditor::create();
     // Set the names and data for our gridfield columns
     $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array('Title' => 'Title', 'StartTime' => 'Start Time', 'EndTime' => 'End Time'));
     // Create a gridfield to hold the calendar event relationship
     $calendarEventsGridField = new GridField('CalendarEvents', 'Calendar Events', $this->CalendarEvents(), $config);
     // Create a tab named "Calendar" and add our field to it
     $fields->addFieldToTab('Root.Calendar', $calendarEventsGridField);
     // Create a default configuration for the location GridField, allowing record deletion
     $locationsConfig = GridFieldConfig::create();
     $locationsConfig->addComponent(new GridFieldButtonRow('before'));
     $locationsConfig->addComponent(new GridFieldToolbarHeader());
     $locationsConfig->addComponent(new GridFieldTitleHeader());
     $locationsConfig->addComponent(new GridFieldEditableColumns());
     $locationsConfig->addComponent(new GridFieldDeleteAction());
     $locationsConfig->addComponent(new GridFieldAddNewInlineButton());
     // Create a gridfield to hold the locations
     $locationsGridField = new GridField('CalendarLocations', 'Calendar Locations', $this->CalendarLocations(), $locationsConfig);
     // Create a tab named "Locations" and add our field to it
     $fields->addFieldToTab('Root.Locations', $locationsGridField);
     return $fields;
 }
开发者ID:pmachapman,项目名称:rcpn.org.nz,代码行数:25,代码来源:CalendarPage.php


注:本文中的GridFieldConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。