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


PHP FieldList::tag方法代码示例

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


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

示例1: getCMSFields

 public function getCMSFields()
 {
     $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : $this->SummitID;
     $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
     $f->addFieldToTab('Root.Main', new TextField('Title', 'Title'));
     $f->addFieldToTab('Root.Main', new HtmlEditorField('Description', 'Description'));
     $f->addFieldToTab('Root.Main', new HtmlEditorField('ShortDescription', 'Short Description'));
     $f->tag('Tags', 'Tags', Tag::get(), $this->Tags())->configure()->setTitleField('Tag')->end();
     $f->addFieldToTab('Root.Main', new CheckboxField('AllowFeedBack', 'Is feedback allowed?'));
     $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID'));
     $f->addFieldToTab('Root.Main', $date = new DatetimeField('StartDate', 'Start Date'));
     $date->getDateField()->setConfig('showcalendar', true);
     $date->setConfig('dateformat', 'dd/MM/yyyy');
     $f->addFieldToTab('Root.Main', $date = new DatetimeField('EndDate', 'End Date'));
     $date->getDateField()->setConfig('showcalendar', true);
     $date->setConfig('dateformat', 'dd/MM/yyyy');
     $locations = SummitAbstractLocation::get()->filter('SummitID', $summit_id)->filter('ClassName', array('SummitVenue', 'SummitVenueRoom', 'SummitExternalLocation'));
     $locations_source = array();
     foreach ($locations as $l) {
         $locations_source[$l->ID] = $l->getFullName();
     }
     $f->addFieldToTab('Root.Main', $ddl_location = new DropdownField('LocationID', 'Location', $locations_source));
     $ddl_location->setEmptyString('-- Select a Location --');
     $f->addFieldToTab('Root.Main', $ddl_location = new DropdownField('TypeID', 'Event Type', SummitEventType::get()->filter('SummitID', $summit_id)->map('ID', 'Type')));
     $ddl_location->setEmptyString('-- Select a Event Type --');
     $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID'));
     if ($this->ID > 0) {
         // summits types
         $config = new GridFieldConfig_RelationEditor(100);
         $config->removeComponentsByType('GridFieldEditButton');
         $config->removeComponentsByType('GridFieldAddNewButton');
         $completer = $config->getComponentByType('GridFieldAddExistingAutocompleter');
         $completer->setSearchList(SummitType::get()->filter('SummitID', $summit_id));
         $summit_types = new GridField('AllowedSummitTypes', 'Summit Types', $this->AllowedSummitTypes(), $config);
         $f->addFieldToTab('Root.Main', $summit_types);
         // sponsors
         $config = new GridFieldConfig_RelationEditor(100);
         $config->removeComponentsByType('GridFieldEditButton');
         $config->removeComponentsByType('GridFieldAddNewButton');
         $sponsors = new GridField('Sponsors', 'Sponsors', $this->Sponsors(), $config);
         $f->addFieldToTab('Root.Sponsors', $sponsors);
         // feedback
         $config = new GridFieldConfig_RecordEditor(100);
         $config->removeComponentsByType('GridFieldAddNewButton');
         $feedback = new GridField('Feedback', 'Feedback', $this->Feedback(), $config);
         $f->addFieldToTab('Root.Feedback', $feedback);
     }
     return $f;
 }
开发者ID:rbowen,项目名称:openstack-org,代码行数:49,代码来源:SummitEvent.php

示例2: getCMSFields

 public function getCMSFields()
 {
     Requirements::customScript("\n        jQuery( document ).ready(function() {\n            jQuery('body').on('change','#Form_ItemEditForm_RSVPTemplateID',\n                function(){\n                    jQuery('#Form_ItemEditForm_action_save').click();\n                }\n            );\n        });");
     $summit_id = isset($_REQUEST['SummitID']) ? $_REQUEST['SummitID'] : $this->SummitID;
     $f = new FieldList($rootTab = new TabSet("Root", $tabMain = new Tab('Main')));
     $f->addFieldToTab('Root.Main', new TextField('Title', 'Title'));
     $f->addFieldToTab('Root.Main', new HtmlEditorField('Description', 'Description'));
     $f->addFieldToTab('Root.Main', new HtmlEditorField('ShortDescription', 'Abstract'));
     $f->addFieldToTab('Root.Main', new TextField('HeadCount', 'HeadCount'));
     $f->tag('Tags', 'Tags', Tag::get(), $this->Tags())->configure()->setTitleField('Tag')->end();
     $f->addFieldToTab('Root.Main', new CheckboxField('AllowFeedBack', 'Is feedback allowed?'));
     $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID'));
     $f->addFieldToTab('Root.Main', $date = new DatetimeField('StartDate', 'Start Date'));
     $date->getDateField()->setConfig('showcalendar', true);
     $date->setConfig('dateformat', 'dd/MM/yyyy');
     $f->addFieldToTab('Root.Main', $date = new DatetimeField('EndDate', 'End Date'));
     $date->getDateField()->setConfig('showcalendar', true);
     $date->setConfig('dateformat', 'dd/MM/yyyy');
     $f->addFieldsToTab('Root.Main', new ReadonlyField('AvgFeedbackRate', 'AvgFeedbackRate'));
     $locations = SummitAbstractLocation::get()->filter('SummitID', $summit_id)->filter('ClassName', array('SummitVenue', 'SummitVenueRoom', 'SummitExternalLocation'));
     $locations_source = array();
     foreach ($locations as $l) {
         $locations_source[$l->ID] = $l->getFullName();
     }
     $f->addFieldToTab('Root.Main', $ddl_location = new DropdownField('LocationID', 'Location', $locations_source));
     $ddl_location->setEmptyString('-- Select a Location --');
     $f->addFieldToTab('Root.Main', $ddl_location = new DropdownField('TypeID', 'Event Type', SummitEventType::get()->filter('SummitID', $summit_id)->map('ID', 'Type')));
     $ddl_location->setEmptyString('-- Select a Event Type --');
     $f->addFieldToTab('Root.Main', new HiddenField('SummitID', 'SummitID'));
     if ($this->ID > 0) {
         // summits types
         $config = new GridFieldConfig_RelationEditor(100);
         $config->removeComponentsByType('GridFieldEditButton');
         $config->removeComponentsByType('GridFieldAddNewButton');
         $completer = $config->getComponentByType('GridFieldAddExistingAutocompleter');
         $completer->setSearchList(SummitType::get()->filter('SummitID', $summit_id));
         $summit_types = new GridField('AllowedSummitTypes', 'Summit Types', $this->AllowedSummitTypes(), $config);
         $f->addFieldToTab('Root.Main', $summit_types);
         // sponsors
         $config = new GridFieldConfig_RelationEditor(100);
         $config->removeComponentsByType('GridFieldEditButton');
         $config->removeComponentsByType('GridFieldAddNewButton');
         $sponsors = new GridField('Sponsors', 'Sponsors', $this->Sponsors(), $config);
         $f->addFieldToTab('Root.Sponsors', $sponsors);
         // feedback
         $config = new GridFieldConfig_RecordEditor(100);
         $config->removeComponentsByType('GridFieldAddNewButton');
         $config->addComponent(new GridFieldAjaxRefresh(1000, false));
         $feedback = new GridField('Feedback', 'Feedback', $this->Feedback(), $config);
         $f->addFieldToTab('Root.Feedback', $feedback);
         // rsvp
         $f->addFieldsToTab('Root.RSVP', new TextField('RSVPLink', 'RSVP External Link'));
         $rsvp_template = new DropdownField('RSVPTemplateID', 'Select a Template', RSVPTemplate::get()->filter('SummitID', $summit_id)->map());
         $rsvp_template->setEmptyString('-- View All Templates --');
         $f->addFieldToTab('Root.RSVP', LiteralField::create('AddNew', 'Or add a new custom RSVP Configuration'));
         $f->addFieldToTab('Root.RSVP', $rsvp_template);
         $f->addFieldToTab('Root.RSVP', new NumericField('RSVPMaxUserNumber', 'Max # Number'));
         $f->addFieldToTab('Root.RSVP', new NumericField('RSVPMaxUserWaitListNumber', 'Max # Wait List'));
         $f->addFieldToTab('Root.RSVP', $rsvp_template);
         if ($this->RSVPTemplate()->exists()) {
             $config = new GridFieldConfig_RecordEditor(100);
             $config->removeComponentsByType('GridFieldAddNewButton');
             $config->addComponent(new GridFieldAjaxRefresh(1000, false));
             $rsvps = new GridField('RSVPSubmissions', 'RSVP Submissions', $this->RSVPSubmissions(), $config);
             $f->addFieldToTab('Root.RSVP', $rsvps);
         }
     }
     if ($this->ID > 0) {
         $_REQUEST['SummitEventID'] = $this->ID;
     }
     return $f;
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:72,代码来源:SummitEvent.php


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