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


PHP ListboxField::setMultiple方法代码示例

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


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

示例1: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('NotificationMembers');
     $fields->removeByName('CreatedByMemberID');
     $fields->addFieldToTab('Root.Main', new TextField('MemberNotificationTitle', 'User notification title'));
     $fields->addFieldToTab('Root.Main', new TextareaField('MemberNotificationMessage', 'User notification message (200) characters only'));
     // members - many_many relation
     $membersMap = Member::get()->sort('FirstName')->map('ID', 'FirstName')->toArray();
     $membersField = new ListboxField('NotificationMembers', 'Select users');
     $membersField->setMultiple(true)->setSource($membersMap);
     $fields->addFieldToTab('Root.Main', $membersField);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:nadzweb-membernotification,代码行数:14,代码来源:MemberNotification.php

示例2: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $localesNames = Fluent::locale_names();
     if (!$this->owner instanceof SiteConfig) {
         // If the ActiveLocales has been applied to SiteConfig, restrict locales to allowed ones
         $conf = SiteConfig::current_site_config();
         if ($conf->hasExtension('ActiveLocalesExtension') && $conf->ActiveLocales) {
             $localesNames = $conf->ActiveLocalesNames();
         }
     }
     // Avoid clutter if we only have one locale anyway
     if (count($localesNames) === 1) {
         return;
     }
     $fields->addFieldToTab('Root.Main', $lang = new ListboxField('ActiveLocales', _t('ActiveLocalesExtension.ACTIVELOCALE', 'Active Languages'), $localesNames));
     $lang->setMultiple(true);
     return $fields;
 }
开发者ID:lekoala,项目名称:silverstripe-devtoolkit,代码行数:18,代码来源:ActiveLocalesExtension.php

示例3: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('FaqPageID');
     $fields->removeByName('FaqTags');
     $fields->removeByName('SortOrder');
     $fields->addFieldToTab('Root.Main', new TextField('Question', 'Question'));
     $fields->addFieldToTab('Root.Main', new HtmlEditorField('Answer', 'Answer'));
     // faq section - has_one relation
     $map = FaqSection::get()->sort('Title')->map('ID', 'Title');
     $field = new DropdownField('FaqSectionID', 'Faq section', $map);
     $field->setEmptyString('None');
     $fields->addFieldToTab('Root.Main', $field, 'Question');
     // faq tags - has_many relation
     $tagMap = FaqTag::get()->sort('Title')->map('ID', 'Title')->toArray();
     $tagsField = new ListboxField('FaqTags', 'Faq tags');
     $tagsField->setMultiple(true)->setSource($tagMap);
     $fields->addFieldToTab('Root.Main', $tagsField, 'Question');
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:nadzweb-advancedfaq,代码行数:20,代码来源:Faq.php

示例4: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $services = SiteConfig::config()->available_services;
     if (!$services) {
         $services = array_keys(self::listAvailableMediaServices());
     }
     if (in_array('twitter', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('TwitterUsername', _t('Socialstream.TwitterUsername', 'Twitter Username')));
     }
     if (in_array('twitter_hashtag', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('TwitterHashtag', _t('Socialstream.TwitterHashtag', 'Twitter Hashtag')));
     }
     if (in_array('facebook_page', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('FacebookPage', _t('Socialstream.FacebookPage', 'Facebook Page')));
     }
     if (in_array('vimeo', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('VimeoUsername', _t('Socialstream.VimeoUsername', 'Vimeo Username')));
     }
     if (in_array('youtube', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('YoutubeUsername', _t('Socialstream.YoutubeUsername', 'Youtube Username')));
     }
     if (in_array('dailymotion', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('DailymotionUsername', _t('Socialstream.DailymotionUsername', 'Dailymotion Username')));
     }
     if (in_array('rss', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('RssFeed', _t('Socialstream.RssFeed', 'Rss Feed')));
     }
     if (in_array('flickr', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('FlickrUsername', _t('Socialstream.FlickrUsername', 'Flickr Username')));
     }
     if (in_array('github', $services)) {
         $fields->addFieldToTab('Root.Social', new TextField('GithubUsername', _t('Socialstream.GithubUsername', 'Github Username')));
     }
     $fields->addFieldToTab('Root.Social', $wl = new ListboxField('LifestreamWhitelist', _t('Socialstream.LifestreamWhitelist', 'Lifestream Whitelist'), array_combine($services, $services)));
     $wl->setMultiple(true);
     $wl->setDescription('A list of services to display on the Lifestream. If left blank, all configured streams will be used.');
     $fields->addFieldToTab('Root.Social', new NumericField('LifestreamItems', _t('Socialstream.LifestreamItems', 'Lifestream Items')));
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:lekoala-silverstripe-socialstream,代码行数:39,代码来源:SocialstreamSiteConfig.php

示例5: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     if ($this->ID) {
         Session::set("FamilyMemberID", $this->ID);
     }
     if (Session::get("FamilyID")) {
         $this->FamilyID = Session::get("FamilyID");
         $fields->replaceField('FamilyID', new HiddenField('FamilyID'));
     }
     $dateOfBirth = new DateField('DateOfBirth', 'Date Of Birth');
     $dateOfBirth->setConfig('dateformat', 'dd-MM-yyyy');
     $dateOfBirth->setDescription('e.g. ' . date('d-m-Y'));
     $dateOfBirth->setAttribute('placeholder', 'dd-MM-yyyy');
     $fields->addFieldsToTab('Root.Main', $dateOfBirth);
     $genders = Config::inst()->get('FamilyMember', 'Gender');
     $gender = new OptionsetField("Gender", 'Gender', $genders);
     $fields->addFieldsToTab('Root.Main', $gender);
     $status = Config::inst()->get('FamilyMember', 'MartialStatus');
     $martialStatus = new OptionsetField("MartialStatus", 'Martial Status', $status);
     $fields->addFieldsToTab('Root.Main', $martialStatus);
     $fields->insertBefore(new Tab('Job', 'Job'), 'CommunityGroups');
     //Job GridField
     $jobGridFieldConfig = GridFieldConfig_RecordEditor::create();
     $jobList = Job::get()->filter(array('FamilyMemberID' => $this->ID))->sort('ID ASC');
     if ($jobList->count()) {
         $jobGridFieldConfig->removeComponentsByType('GridFieldAddNewButton');
     }
     $jobGridField = new GridField('Job', 'Job', $jobList, $jobGridFieldConfig);
     $fields->addFieldsToTab('Root.Job', array($jobGridField));
     $fields->insertBefore(new Tab('Health', 'Health'), 'CommunityGroups');
     //Health GridField
     $healthGridFieldConfig = GridFieldConfig_RecordEditor::create();
     $healthList = Health::get()->filter(array('FamilyMemberID' => $this->ID))->sort('ID ASC');
     if ($healthList->count()) {
         $healthGridFieldConfig->removeComponentsByType('GridFieldAddNewButton');
     }
     $healthGridField = new GridField('Health', 'Health', $healthList, $healthGridFieldConfig);
     $fields->addFieldsToTab('Root.Health', array($healthGridField));
     //Job GridField
     /*
     $communityGroupsCongfig = GridFieldConfig_RelationEditor::create();
     //$jobGridFieldConfig = GridFieldConfig_RecordEditor::create();
     $communityGroupsList = $this->CommunityGroups();
     $communityGroupsGridField = new GridField('CommunityGroups', 'Community Groups',
     	$communityGroupsList,
     	$communityGroupsCongfig);
     $fields->addFieldsToTab('Root.CommunityGroups', array(
     	$communityGroupsGridField
     ));
     */
     //CommunityGroups ListboxField
     $communityGroupsList = CommunityGroup::get()->map('ID', 'Title')->toArray();
     $communityGroupsField = new ListboxField($name = "CommunityGroups", $title = "Communtiy Groups", $communityGroupsList);
     $communityGroupsField->setMultiple(true);
     $fields->addFieldsToTab('Root.CommunityGroups', $communityGroupsField);
     //exit('dd');
     return $fields;
 }
开发者ID:thomaspaulson,项目名称:myparish,代码行数:59,代码来源:FamilyMember.php

示例6: testSaveIntoManyManyRelation

 public function testSaveIntoManyManyRelation()
 {
     $article = $this->objFromFixture('ListboxFieldTest_Article', 'articlewithouttags');
     $articleWithTags = $this->objFromFixture('ListboxFieldTest_Article', 'articlewithtags');
     $tag1 = $this->objFromFixture('ListboxFieldTest_Tag', 'tag1');
     $tag2 = $this->objFromFixture('ListboxFieldTest_Tag', 'tag2');
     $field = new ListboxField("Tags", "Test field", DataObject::get("ListboxFieldTest_Tag")->map()->toArray());
     $field->setMultiple(true);
     // Save new relations
     $field->setValue(array($tag1->ID, $tag2->ID));
     $field->saveInto($article);
     $article = Dataobject::get_by_id('ListboxFieldTest_Article', $article->ID, false);
     $this->assertEquals(array($tag1->ID, $tag2->ID), $article->Tags()->sort('ID')->column('ID'));
     // Remove existing relation
     $field->setValue(array($tag1->ID));
     $field->saveInto($article);
     $article = Dataobject::get_by_id('ListboxFieldTest_Article', $article->ID, false);
     $this->assertEquals(array($tag1->ID), $article->Tags()->sort('ID')->column('ID'));
     // Set NULL value
     $field->setValue(null);
     $field->saveInto($article);
     $article = Dataobject::get_by_id('ListboxFieldTest_Article', $article->ID, false);
     $this->assertEquals(array(), $article->Tags()->sort('ID')->column('ID'));
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:24,代码来源:ListboxFieldTest.php


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