本文整理汇总了PHP中DateField::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP DateField::setAttribute方法的具体用法?PHP DateField::setAttribute怎么用?PHP DateField::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateField
的用法示例。
在下文中一共展示了DateField::setAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}