本文整理汇总了PHP中GridFieldConfig_RelationEditor::create方法的典型用法代码示例。如果您正苦于以下问题:PHP GridFieldConfig_RelationEditor::create方法的具体用法?PHP GridFieldConfig_RelationEditor::create怎么用?PHP GridFieldConfig_RelationEditor::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridFieldConfig_RelationEditor
的用法示例。
在下文中一共展示了GridFieldConfig_RelationEditor::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateSettingsFields
public function updateSettingsFields($fields)
{
$config = GridFieldConfig_RelationEditor::create();
$config->removeComponentsByType('GridFieldDeleteAction');
$config->addComponent(new GridFieldDeleteAction());
$fields->addFieldToTab('Root.OldUrls', new GridField('OldURLRedirects', 'Old URLs', $this->owner->OldURLRedirects(), $config));
}
示例2: updateCMSFields
/**
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
{
$fields->addFieldsToTab('Root.Related', array($grid = GridField::create("RelatedProductsRelation", "Related Products", $this->owner->RelatedProductsRelation()->sort('Order', 'ASC'), GridFieldConfig_RelationEditor::create()->removeComponentsByType("GridFieldAddNewButton")->removeComponentsByType("GridFieldEditButton")->addComponent(new GridFieldOrderableRows('Order'))->addComponent(new GridFieldEditableColumns()))));
$grid->getConfig()->getComponentByType('GridFieldEditableColumns')->setDisplayFields(array('RelatedTitle' => function ($record, $column, $grid) {
return new TextField($column);
}));
}
示例3: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$sortable = singleton('CleanTeaser')->hasExtension('SortableDataExtension');
$config = GridFieldConfig_RelationEditor::create();
$config->addComponent($gridFieldForm = new GridFieldDetailForm());
$dataFields = array();
if (singleton('CleanTeaser')->hasExtension('CMSPublishableDataExtension')) {
$dataFields['PublishIndicator'] = 'Published';
}
$dataFields = array_merge($dataFields, array('Thumbnail' => 'Thumbnail', 'Title' => 'Title', 'CleanDescription' => 'Description'));
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields($dataFields);
$gridFieldForm->setTemplate('CMSGridFieldPopupForms');
if ($sortable) {
$config->addComponent(new GridFieldSortableRows('SortOrder'));
}
if (ClassInfo::exists('GridFieldBulkUpload')) {
$iu = new GridFieldBulkUpload('ImageID');
if (singleton('CleanTeaser')->hasExtension('ControlledFolderDataExtension')) {
$iu->setUfConfig('folderName', singleton('CleanTeaser')->getUploadFolder());
} else {
$iu->setUfConfig('folderName', CleanTeaser::$upload_folder);
}
$config->addComponent($iu);
}
if ($sortable) {
$data = $this->owner->CleanTeasers("ClassName = 'CleanTeaser'")->sort('SortOrder');
} else {
$data = $this->owner->CleanTeasers("ClassName = 'CleanTeaser'");
}
// $config->removeComponentsByType('GridFieldAddNewButton');
// if (ClassInfo::exists('GridFieldBulkUpload')) {
// $config->addComponent(new GridFieldAddNewMultiClass());
// }
$fields->addFieldToTab("Root.Teasers", GridField::create('CleanTeasers', 'CleanTeaser', $data, $config));
}
示例4: getFieldsForImagesTab
/**
* Returns array of fields to be added to Gallery Images Tab
*
* @return array
*/
public function getFieldsForImagesTab()
{
$aFields[] = new HeaderField(_t('ResponsiveGalleryExtension.SOURCE_HEADER', 'Choose your desired image source'));
$aFields[] = new OptionsetField("Source", _t('ResponsiveGalleryExtension.SOURCE_LABEL', 'Source'), array("sf" => _t('ResponsiveGalleryExtension.SOURCEFOLDER_LABEL', 'Source Folder'), "dl" => _t('ResponsiveGalleryExtension.DATALIST_LABEL', 'Data List')), "sf");
switch ($this->owner->Source) {
case "dl":
$oGridFieldConfig = GridFieldConfig_RelationEditor::create()->addComponents(new GridFieldEditButton(), new GridFieldDeleteAction(), new GridFieldDetailForm(), new GridFieldBulkUpload('GalleryImage'), new GridFieldSortableRows('SortOrder'));
$oGridFieldConfig->getComponentByType('GridFieldBulkUpload')->setUfSetup('setFolderName', $this->getUploadFolder())->setUfConfig('sequentialUploads', true);
$aFields[] = new HeaderField(_t('ResponsiveGalleryExtension.DATALIST_HEADER', 'Create your image list'));
$aFields[] = LiteralField::create("DataListInfo", '<div class="field"><p>' . _t('ResponsiveGalleryExtension.DATALIST_INFO', 'You can select images from files or upload images and add them to your customized image list. ' . 'Use "Target Folder" field to select a default target folder for your image uploads.') . '</p></div>');
$aFields[] = new TreeDropdownField('UploadFolderID', _t('ResponsiveGalleryExtension.UPLOADFOLDER_LABEL', 'Target Folder'), 'Folder');
$aFields[] = new GridField("GalleryImages", _t('ResponsiveGalleryExtension.IMAGES_LABEL', 'Images'), $this->getImages(), $oGridFieldConfig);
break;
case "sf":
$iImageCount = $this->countImages();
$aFields[] = new HeaderField(_t('ResponsiveGalleryExtension.SOURCEFOLDER_HEADER', 'Select source folder of gallery'));
$aFields[] = new TreeDropdownField('SourceFolderID', _t('ResponsiveGalleryExtension.SOURCEFOLDER_LABEL', 'Source Folder'), 'Folder');
if ($this->isSourcefolderSelected()) {
$aFields[] = LiteralField::create("ImageCountInfo", '<div class="field">' . '<p class="info-message">' . _t('ResponsiveGalleryExtension.IMAGECOUNTINFO', 'There are {imageCount} images in your selected folder.', 'The number of images in this gallery', array('imageCount' => $iImageCount)) . '</p></div>');
} else {
$aFields[] = LiteralField::create("NoSelectedFolderInfo", '<div class="field">' . '<p><span class="info-message">' . _t('ResponsiveGalleryExtension.NOSELECTEDFOLDER_INFO', 'Please select a folder that contains the images to be displayed in this gallery.') . '</p></div>');
}
break;
default:
$aFields[] = LiteralField::create("SelectSourceInfo", '<div class="field">' . '<p><span class="info-message">' . _t('ResponsiveGalleryExtension.SELECTSOURCEINFO_HEADER', 'Please select your desired image source type in field above.') . '</span><br/>' . _t('ResponsiveGalleryExtension.SELECTSOURCE_INFO', 'Then click on save button below, to be able to configure this gallery.') . '</p></div>');
}
return $aFields;
}
示例5: updateCMSFields
/**
* Setup the CMS Fields
*
* @param FieldList
*/
public function updateCMSFields(FieldList $fields)
{
if (!$this->supportsElemental()) {
return false;
}
// add an empty holder for content as some module explicitly use insert
// after content.
$fields->replaceField('Content', new LiteralField('Content', ''));
$adder = new ElementalGridFieldAddNewMultiClass();
$list = $this->getAvailableTypes();
$adder->setClasses($list);
$area = $this->owner->ElementArea();
if (!$area->exists() || !$area->isInDB()) {
$area->write();
$this->owner->ElementAreaID = $area->ID;
$this->owner->write();
}
$gridField = GridField::create('ElementArea', Config::inst()->get("ElementPageExtension", 'elements_title'), $this->owner->ElementArea()->Elements(), GridFieldConfig_RelationEditor::create()->removeComponentsByType('GridFieldAddNewButton')->removeComponentsByType('GridFieldDeleteAction')->removeComponentsByType('GridFieldAddExistingAutocompleter')->addComponent(new ElementalGridFieldAddExistingAutocompleter())->addComponent(new ElementalGridFieldDeleteAction())->addComponent($adder)->addComponent(new GridFieldSortableRows('Sort')));
$config = $gridField->getConfig();
$paginator = $config->getComponentByType('GridFieldPaginator');
$paginator->setItemsPerPage(100);
$config->removeComponentsByType('GridFieldDetailForm');
$config->addComponent(new VersionedDataObjectDetailsForm());
$fields->addFieldToTab('Root.Main', $gridField);
return $fields;
}
示例6: updateCMSFields
/**
* CMS Fields
* @return FieldList
*/
public function updateCMSFields(FieldList $fields)
{
if (!Permission::check("VIEW_SECTIONS")) {
return $fields;
}
$SectionGrid = GridFieldConfig_RelationEditor::create()->removeComponentsByType('GridFieldAddNewButton')->addComponent(new GridFieldAddNewMultiClass())->addComponent(new GridFieldOrderableRows());
$SectionGrid->getComponentByType('GridFieldAddExistingAutocompleter')->setSearchFields(array('AdminTitle', 'MenuTitle'))->setResultsFormat('$AdminTitle - $Type');
$AvailableTypes = $this->AvailableSectionTypes();
foreach ($AvailableTypes as $key => $value) {
if ($value['selectable_option'] && !$value['limit_reached']) {
$AvailableTypes[$key] = $value['type'];
}
}
$SectionGrid->getComponentByType('GridFieldAddNewMultiClass')->setClasses($AvailableTypes);
// Limit total sections
$LimitSectionTotal = Config::inst()->get($this->owner->ClassName, 'LimitSectionTotal');
if (isset($LimitSectionTotal) && $this->owner->Sections()->Count() >= $LimitSectionTotal) {
// remove the buttons if we don't want to allow more records to be added/created
$SectionGrid->removeComponentsByType('GridFieldAddNewButton');
$SectionGrid->removeComponentsByType('GridFieldAddExistingAutocompleter');
$SectionGrid->removeComponentsByType('GridFieldAddNewMultiClass');
}
if (!Permission::check("LINK_SECTIONS")) {
$SectionGrid->removeComponentsByType('GridFieldAddExistingAutocompleter');
}
if (!Permission::check("REORDER_SECTIONS")) {
$SectionGrid->removeComponentsByType('GridFieldOrderableRows');
}
if (!Permission::check("UNLINK_SECTIONS")) {
$SectionGrid->removeComponentsByType('GridFieldDeleteAction');
}
$fields->addFieldToTab('Root.Section', GridField::create('Sections', 'Current Section(s)', $this->owner->Sections(), $SectionGrid));
$fields->addFieldToTab('Root.Preview', UploadField::create('PreviewImage', 'Preview image')->setFolderName('Preview'));
return $fields;
}
示例7: getCMSFields
public function getCMSFields()
{
$f = parent::getCMSFields();
$member = TeamMember::get();
$f->addFieldToTab('Root.Team', new GridField('TeamGrid', 'Team', $member, GridFieldConfig_RelationEditor::create()));
return $f;
}
示例8: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
// Contact Form settings
$recipient_field = new EmailField('DefaultRecipient', 'Email recipient');
$recipient_field->setDescription('Default email address to send submissions to.');
$subject_field = new TextField('Subject', 'Email subject');
$subject_field->setDescription('Subject for the email.');
$default_from_field = new EmailField('DefaultFrom', 'Email from');
$default_from_field->setDescription('Default from email address.');
$fields->addFieldToTab('Root.ContactForm.Settings', $recipient_field);
$fields->addFieldToTab('Root.ContactForm.Settings', $subject_field);
$fields->addFieldToTab('Root.ContactForm.Settings', $default_from_field);
// Contact Form fields
$conf = GridFieldConfig_RelationEditor::create(10);
$conf->addComponent(new GridFieldSortableRows('SortOrder'));
$data_columns = $conf->getComponentByType('GridFieldDataColumns');
$data_columns->setDisplayFields(array('Name' => 'Name', 'Type' => 'Type', 'requiredText' => 'Required'));
$contact_form_fields = new GridField('Fields', 'Field', $this->ContactFields(), $conf);
$fields->addFieldToTab('Root.ContactForm.Fields', $contact_form_fields);
// Recipient map
$contact_fields = array();
foreach ($this->ContactFields() as $contact_field) {
$contact_fields[$contact_field->Name] = $contact_field->Name;
}
$recipient_map_field_field = new DropdownField('RecipientMapField', 'Recipient Map Field', $contact_fields);
$recipient_map_field_field->setDescription('Field used to map recipients.');
$recipient_map_field = new TextareaField('RecipientMap', 'Recipient Map');
$recipient_map_field->setDescription('Map field values to an email address (format: value:email address) one per line.');
$fields->addFieldToTab('Root.ContactForm.RecipientMap', $recipient_map_field_field);
$fields->addFieldToTab('Root.ContactForm.RecipientMap', $recipient_map_field);
return $fields;
}
示例9: getCMSFields
public function getCMSFields()
{
$f = parent::getCMSFields();
$lots = Lot::get();
$f->addFieldToTab('Root.Lots', new GridField('LotGrid', 'Lots', $lots, GridFieldConfig_RelationEditor::create()));
return $f;
}
示例10: getCMSFields
/**
*
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$states = new GridField('FlowStates', 'FlowState', $this->FlowStates(), $config = GridFieldConfig_RelationEditor::create());
$fields->addFieldToTab('Root.FlowStates', $states);
return $fields;
}
示例11: getCMSFields
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->insertBefore(new DropdownField('MemberID', 'Member', Member::get()->map('ID', "FirstName")), 'AttendingWholeEvent');
$siteConfig = SiteConfig::current_site_config();
$current = $siteConfig->getCurrentEventID();
if ($this->ParentID < 1) {
$event = Event::get()->byID($current);
} else {
$event = Event::get()->byID($this->ParentID);
}
$fields->insertAfter(HiddenField::create('ParentID', 'Event', $event->ID), 'ExtraDetail');
$fields->removeByName('PublicFieldsRaw');
$fields->removeByName('Sort');
if ($this->PlayerGames()->Count() > 0) {
$gridField = new GridField('PlayerGames', 'Games', $this->PlayerGames(), $config = GridFieldConfig_RelationEditor::create());
$gridField->setModelClass('PlayerGame');
$config->addComponent(new GridFieldOrderableRows());
$config->removeComponentsByType('GridFieldPaginator');
$config->removeComponentsByType('GridFieldPageCount');
$config->addComponent(new GridFieldDeleteAction(false));
$config->addComponent($export = new GridFieldExportButton('before'));
$export->setExportColumns(singleton("PlayerGame")->getExportFields());
$fields->addFieldToTab('Root.PlayerGames', $gridField);
}
return $fields;
}
示例12: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
$fields->addFieldToTab("Root.SocialLinks", GridField::create("SocialLinks", "Social Network Links", $this->owner->SocialLinks(), $config = GridFieldConfig_RelationEditor::create()));
if (class_exists("GridFieldOrderableRows")) {
$config->addComponent(new GridFieldOrderableRows());
}
}
示例13: getCMSFields
public function getCMSFields()
{
$f = parent::getCMSFields();
$plans = FloorPlan::get();
$f->addFieldToTab('Root.Floorplans', new GridField('FloorplanGrid', 'Floorplans', $plans, GridFieldConfig_RelationEditor::create()));
return $f;
}
示例14: updateCMSFields
public function updateCMSFields(FieldList $fields)
{
/** @var Page|MapaelCountryHolderPageExtension $page */
$page = $this->getOwner();
$tab = $fields->findOrMakeTab('Root.CountryPagesTab', $page->fieldLabel('CountryPages'));
$tab->push(GridField::create('CountryPages', $page->fieldLabel('CountryPages'), $page->CountryPages(), GridFieldConfig_RelationEditor::create()));
}
示例15: getCMSFields
public function getCMSFields()
{
$f = parent::getCMSFields();
$homes = Home::get();
$f->addFieldToTab('Root.Homes', new GridField('HomeGrid', 'Homes', $homes, GridFieldConfig_RelationEditor::create()));
return $f;
}