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


PHP DateField::setDescription方法代码示例

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


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

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

示例2: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $group = new FieldGroup();
     $group->setTitle(_t('News.Author'));
     $group->setDescription(_t('News.AuthorPage'));
     $fields->addFieldToTab('Root.Main', $group, 'Metadata');
     $field = new TextField('AuthorName', _t('News.Name'));
     $group->push($field);
     $field = new TextField('AuthorURI', _t('News.URI'));
     $group->push($field);
     $field = new TextField('AuthorEmail', _t('News.Email'));
     $group->push($field);
     $field = new DateField('Published', _t('News.Published'));
     $field->setDescription(_t('News.PublishedDescription'));
     $field->setLocale($this->config()->date_locale);
     $field->setConfig('dateformat', $this->config()->date_format);
     $field->setConfig('showcalendar', true);
     $fields->addFieldToTab('Root.Main', $field, 'Content');
     $field = new HtmlEditorField('Summary', _t('News.Summary'));
     $field->setRows(4);
     $fields->addFieldToTab('Root.Main', $field, 'Content');
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:entidi-silverstripe-news,代码行数:24,代码来源:NewsPage.php


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