本文整理汇总了PHP中EmailField类的典型用法代码示例。如果您正苦于以下问题:PHP EmailField类的具体用法?PHP EmailField怎么用?PHP EmailField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EmailField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _createForgotPassForm
public function _createForgotPassForm()
{
$form = new Form();
$form->action = "/forgotpass";
$form->add(EmailField::name('email')->label('Email')->help('What is your email address?')->required(true));
return $form;
}
开发者ID:JoonasMelin,项目名称:BotQueue,代码行数:7,代码来源:auth.php
示例2: 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;
}
开发者ID:helpfulrobot,项目名称:chtombleson-silverstripe-streamline,代码行数:33,代码来源:StreamLineContactPage.php
示例3: McSubscribeForm
/**
* Create the subscription form
* @return \Form
*/
public function McSubscribeForm()
{
$fieldsArr = array();
$email = new EmailField('Email', 'Email');
$email->setValue('Your e-mail');
array_push($fieldsArr, $email);
if (Config::inst()->get('MailChimpController', 'country')) {
$country = new CountryDropdownField('Country', 'Country');
array_push($fieldsArr, $country);
}
if (Config::inst()->get('MailChimpController', 'topics')) {
$topicsArr = Config::inst()->get('MailChimpController', 'topicsArr');
$topics = new CheckboxSetField($name = "Topics", $title = "I am interested in the following topics", $topicsArr, $value = NULL);
array_push($fieldsArr, $topics);
}
if (Config::inst()->get('MailChimpController', 'otherTopic')) {
$otherTopic = new TextField('Other', '');
array_push($fieldsArr, $otherTopic);
}
$fields = new FieldList($fieldsArr);
$actions = new FieldList(new FormAction('McDoSubscribeForm', 'Send Now'));
$required = new RequiredFields(array('Email'));
$form = new Form($this, 'McSubscribeForm', $fields, $actions, $required);
return $form;
}
开发者ID:helpfulrobot,项目名称:zirak-silverstripe-mailchimp,代码行数:29,代码来源:MailChimpController.php
示例4: EditProfileForm
/**
* @return Form|SS_HTTPResponse
*/
public function EditProfileForm()
{
if (!Member::currentUser()) {
$this->setFlash(_t('EditProfilePage.LoginWarning', 'Please login to edit your profile'), 'warning');
return $this->redirect(Director::absoluteBaseURL());
}
$firstName = new TextField('FirstName');
$firstName->setAttribute('placeholder', _t('EditProfilePage.FirstNamePlaceholder', 'Enter your first name'))->setAttribute('required', 'required')->addExtraClass('form-control');
$surname = new TextField('Surname');
$surname->setAttribute('placeholder', _t('EditProfilePage.SurnamePlaceholder', 'Enter your surname'))->setAttribute('required', 'required')->addExtraClass('form-control');
$email = new EmailField('Email');
$email->setAttribute('placeholder', _t('EditProfilePage.EmailPlaceholder', 'Enter your email address'))->setAttribute('required', 'required')->addExtraClass('form-control');
$jobTitle = new TextField('JobTitle');
$jobTitle->setAttribute('placeholder', _t('EditProfilePage.JobTitlePlaceholder', 'Enter your job title'))->addExtraClass('form-control');
$website = new TextField('Website');
$website->setAttribute('placeholder', _t('EditProfilePage.WebsitePlaceholder', 'Enter your website'))->addExtraClass('form-control');
$blurb = new TextareaField('Blurb');
$blurb->setAttribute('placeholder', _t('EditProfilePage.BlurbPlaceholder', 'Enter your blurb'))->addExtraClass('form-control');
$confirmPassword = new ConfirmedPasswordField('Password', _t('EditProfilePage.PasswordLabel', 'New Password'));
$confirmPassword->canBeEmpty = true;
$confirmPassword->setAttribute('placeholder', _t('EditProfilePage.PasswordPlaceholder', 'Enter your password'))->addExtraClass('form-control');
$fields = new FieldList($firstName, $surname, $email, $jobTitle, $website, $blurb, $confirmPassword);
$action = new FormAction('SaveProfile', _t('EditProfilePage.SaveProfileText', 'Update Profile'));
$action->addExtraClass('btn btn-primary btn-lg');
$actions = new FieldList($action);
// Create action
$validator = new RequiredFields('FirstName', 'Email');
//Create form
$form = new Form($this, 'EditProfileForm', $fields, $actions, $validator);
//Populate the form with the current members data
$Member = Member::currentUser();
$form->loadDataFrom($Member->data());
//Return the form
return $form;
}
开发者ID:ormandroid,项目名称:ss_boilerplate,代码行数:38,代码来源:EditProfilePage.php
示例5: testMessagesInsideNestedCompositeFields
public function testMessagesInsideNestedCompositeFields()
{
$fieldGroup = new FieldGroup(new CompositeField($textField = new TextField('TestField', 'Test Field'), $emailField = new EmailField('TestEmailField', 'Test Email Field')));
$textField->setError('Test error message', 'warning');
$emailField->setError('Test error message', 'error');
$this->assertEquals('Test error message, Test error message.', $fieldGroup->Message());
$this->assertEquals('warning. error', $fieldGroup->MessageType());
}
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:8,代码来源:FieldGroupTest.php
示例6: __construct
function __construct($controller, $name, $use_actions = true)
{
$fields = new FieldList();
//point of contact
$fields->push($point_of_contact_name = new TextField('point_of_contact_name', 'Name'));
$fields->push($point_of_contact_email = new EmailField('point_of_contact_email', 'Email'));
//main info
$fields->push($title = new TextField('title', 'Title'));
$fields->push($url = new TextField('url', 'Url'));
$fields->push(new CheckboxField('is_coa_needed', 'Is COA needed?'));
$fields->push($ddl_type = new DropdownField('job_type', 'Job Type', JobType::get()->sort("Type")->map("ID", "Type")));
$ddl_type->setEmptyString("--SELECT A JOB TYPE --");
$fields->push($description = new HtmlEditorField('description', 'Description'));
$fields->push($instructions = new HtmlEditorField('instructions', 'Instructions To Apply'));
$fields->push($expiration_date = new TextField('expiration_date', 'Expiration Date'));
$fields->push($company = new CompanyField('company', 'Company'));
$point_of_contact_name->addExtraClass('job_control');
$point_of_contact_email->addExtraClass('job_control');
$title->addExtraClass('job_control');
$url->addExtraClass('job_control');
$description->addExtraClass('job_control');
$instructions->addExtraClass('job_control');
$expiration_date->addExtraClass('job_control');
$company->addExtraClass('job_control');
//location
$ddl_locations = new DropdownField('location_type', 'Location Type', array('N/A' => 'N/A', 'Remote' => 'Remote', 'Various' => 'Add a Location'));
$ddl_locations->addExtraClass('location_type');
$ddl_locations->addExtraClass('job_control');
$fields->push($ddl_locations);
$fields->push($city = new TextField('city', 'City'));
$fields->push($state = new TextField('state', 'State'));
$fields->push($country = new CountryDropdownField('country', 'Country'));
$city->addExtraClass('physical_location');
$state->addExtraClass('physical_location');
$country->addExtraClass('physical_location');
// Guard against automated spam registrations by optionally adding a field
// that is supposed to stay blank (and is hidden from most humans).
// The label and field name are intentionally common ("username"),
// as most spam bots won't resist filling it out. The actual username field
// on the forum is called "Nickname".
$fields->push(new TextField('user_name', 'UserName'));
// Create action
$actions = new FieldList();
if ($use_actions) {
$actions->push(new FormAction('saveJobRegistrationRequest', 'Save'));
}
// Create validators
$validator = new ConditionalAndValidationRule([new HtmlPurifierRequiredValidator('title', 'instructions', 'description'), new RequiredFields('job_type', 'point_of_contact_name', 'point_of_contact_email')]);
$this->addExtraClass('job-registration-form');
$this->addExtraClass('input-form');
parent::__construct($controller, $name, $fields, $actions, $validator);
}
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:52,代码来源:JobRegistrationRequestForm.php
示例7: getFormField
public function getFormField()
{
if ($this->Required) {
// Required and Email validation can conflict so add the Required validation messages
// as input attributes
$errorMessage = $this->getErrorMessage()->HTML();
$field = new EmailField($this->Name, $this->Title);
$field->setAttribute('data-rule-required', 'true');
$field->setAttribute('data-msg-required', $errorMessage);
return $field;
}
return new EmailField($this->Name, $this->Title);
}
开发者ID:vinstah,项目名称:body,代码行数:13,代码来源:EditableEmailField.php
示例8: __construct
public function __construct($controller, $name)
{
$member = Member::currentUser();
$requiredFields = null;
if ($member && $member->exists()) {
/**
* 29-01-2015 Cambio realizado para no recoger todos los datos de Member
* ----------
* Solo pillamos datos basicos
*/
//$fields = $member->getMemberFormFields();
//$fields->removeByName('Password');
$fields = new FieldList($firstname = TextField::create('FirstName', _t('CheckoutField.FIRSTNAME', 'First Name')), $surname = TextField::create('Surname', _t('CheckoutField.SURNAME', 'Surname')), $email = EmailField::create('Email', _t('CheckoutField.EMAIL', 'Email')));
$requiredFields = $member->getValidator();
$requiredFields->addRequiredField('Surname');
} else {
$fields = new FieldList();
}
if (get_class($controller) == 'AccountPage_Controller') {
$actions = new FieldList(new FormAction('submit', _t('MemberForm.SAVE', 'Save Changes')));
} else {
$actions = new FieldList(new FormAction('submit', _t('MemberForm.SAVE', 'Save Changes')), new FormAction('proceed', _t('MemberForm.SAVEANDPROCEED', 'Save and proceed to checkout')));
}
parent::__construct($controller, $name, $fields, $actions, $requiredFields);
if ($member) {
$member->Password = "";
//prevents password field from being populated with encrypted password data
$this->loadDataFrom($member);
}
if ($record = $controller->data()) {
$record->extend('updateShopAccountForm', $fields, $actions, $requiredFields);
}
}
开发者ID:8secs,项目名称:cocina,代码行数:33,代码来源:ShopAccountForm.php
示例9: __construct
/**
* @param Controller $controller
* @param String $name
* @param array $arguments
*/
public function __construct($controller, $name, $arguments = array())
{
/** -----------------------------------------
* Fields
* ----------------------------------------*/
/** @var EmailField $email */
$email = EmailField::create('Email', 'Email Address');
$email->addExtraClass('form-control')->setAttribute('data-parsley-required-message', 'Please enter your <strong>Email</strong>')->setCustomValidationMessage('Please enter your <strong>Email</strong>');
$fields = FieldList::create($email);
/** -----------------------------------------
* Actions
* ----------------------------------------*/
$actions = FieldList::create(FormAction::create('Subscribe')->setTitle('Subscribe')->addExtraClass('btn btn-primary'));
/** -----------------------------------------
* Validation
* ----------------------------------------*/
$required = RequiredFields::create('Email');
/** @var Form $form */
$form = Form::create($this, $name, $fields, $actions, $required);
if ($formData = Session::get('FormInfo.Form_' . $name . '.data')) {
$form->loadDataFrom($formData);
}
parent::__construct($controller, $name, $fields, $actions, $required);
$this->setAttribute('data-parsley-validate', true);
$this->addExtraClass('form');
}
开发者ID:helpfulrobot,项目名称:ryanpotter-silverstripe-boilerplate,代码行数:31,代码来源:SubscriptionForm.php
示例10: __construct
public function __construct($name, $title = null, $value = "")
{
// naming with underscores to prevent values from actually being saved somewhere
$this->fieldType = new OptionsetField("{$name}[Type]", _t('HtmlEditorField.LINKTO', 'Link to'), array('Internal' => _t('HtmlEditorField.LINKINTERNAL', 'Page on the site'), 'External' => _t('HtmlEditorField.LINKEXTERNAL', 'Another website'), 'Email' => _t('HtmlEditorField.LINKEMAIL', 'Email address'), 'File' => _t('HtmlEditorField.LINKFILE', 'Download a file')), 'Internal');
$this->fieldLink = new CompositeField($this->internalField = WTTreeDropdownField::create("{$name}[Internal]", _t('HtmlEditorField.Internal', 'Internal'), 'SiteTree', 'ID', 'Title', true), $this->externalField = TextField::create("{$name}[External]", _t('HtmlEditorField.URL', 'URL'), 'http://'), $this->emailField = EmailField::create("{$name}[Email]", _t('HtmlEditorField.EMAIL', 'Email address')), $this->fileField = WTTreeDropdownField::create("{$name}[File]", _t('HtmlEditorField.FILE', 'File'), 'File', 'ID', 'Title', true), $this->extraField = TextField::create("{$name}[Extra]", 'Extra(optional)')->setDescription('Appended to url. Use to add sub-urls/actions or query string to the url, e.g. ?param=value'), $this->anchorField = TextField::create("{$name}[Anchor]", 'Anchor (optional)'), $this->targetBlankField = CheckboxField::create("{$name}[TargetBlank]", _t('HtmlEditorField.LINKOPENNEWWIN', 'Open link in a new window?')));
if ($linkableDataObjects = WTLink::get_data_object_types()) {
if (!($objects = self::$linkable_data_objects)) {
$objects = array();
foreach ($linkableDataObjects as $className) {
$classObjects = array();
//set the format for DO value -> ClassName-ID
foreach (DataList::create($className) as $object) {
$classObjects[$className . '-' . $object->ID] = $object->Title;
}
if (!empty($classObjects)) {
$objects[singleton($className)->i18n_singular_name()] = $classObjects;
}
}
}
if (count($objects)) {
$this->fieldType->setSource(array_merge($this->fieldType->getSource(), array('DataObject' => _t('WTLinkField.LINKDATAOBJECT', 'Data Object'))));
$this->fieldLink->insertBefore("{$name}[Extra]", $this->dataObjectField = GroupedDropdownField::create("{$name}[DataObject]", _t('WTLinkField.LINKDATAOBJECT', 'Link to a Data Object'), $objects));
}
self::$linkable_data_objects = $objects;
}
$this->extraField->addExtraClass('no-hide');
$this->anchorField->addExtraClass('no-hide');
$this->targetBlankField->addExtraClass('no-hide');
parent::__construct($name, $title, $value);
}
开发者ID:webtorque7,项目名称:link-field,代码行数:30,代码来源:WTLinkField.php
示例11: __construct
/**
* @param Controller $controller
* @param String $name
* @param array $arguments
*/
public function __construct($controller, $name, $arguments = array())
{
/** =========================================
* @var EmailField $emailField
* @var TextField $nameField
* @var FormAction $submit
* @var Form $form
===========================================*/
/** -----------------------------------------
* Fields
* ----------------------------------------*/
$emailField = EmailField::create('Email', 'Email Address');
$emailField->addExtraClass('form-control')->setAttribute('placeholder', 'Email')->setAttribute('data-parsley-required-message', 'Please enter your <strong>Email</strong>')->setCustomValidationMessage('Please enter your <strong>Email</strong>');
$nameField = TextField::create('Name', 'Name');
$nameField->setAttribute('placeholder', 'Name')->setAttribute('data-parsley-required-message', 'Please enter your <strong>Name</strong>')->setCustomValidationMessage('Please enter your <strong>Name</strong>');
$fields = FieldList::create($nameField, $emailField);
/** -----------------------------------------
* Actions
* ----------------------------------------*/
$submit = FormAction::create('Subscribe');
$submit->setTitle('SIGN UP')->addExtraClass('button');
$actions = FieldList::create($submit);
/** -----------------------------------------
* Validation
* ----------------------------------------*/
$required = RequiredFields::create('Name', 'Email');
$form = Form::create($this, $name, $fields, $actions, $required);
if ($formData = Session::get('FormInfo.Form_' . $name . '.data')) {
$form->loadDataFrom($formData);
}
parent::__construct($controller, $name, $fields, $actions, $required);
$this->setAttribute('data-parsley-validate', true);
$this->addExtraClass('form');
}
开发者ID:toastnz,项目名称:quicksilver,代码行数:39,代码来源:SubscriptionForm.php
示例12: UpdateForm
public function UpdateForm()
{
$member = singleton('SecurityContext')->getMember();
if (!$member) {
return '';
}
// if there's a member profile page availble, use it
$filter = array();
if (class_exists('Multisites')) {
$filter = array('SiteID' => Multisites::inst()->getCurrentSiteId());
}
// use member profile page if possible
if (class_exists('MemberProfilePage') && ($profilePage = MemberProfilePage::get()->filter($filter)->first())) {
$controller = MemberProfilePage_Controller::create($profilePage);
$form = $controller->ProfileForm();
$form->addExtraClass('ajax-form');
$form->loadDataFrom($member);
return $form;
} else {
$password = new ConfirmedPasswordField('Password', $member->fieldLabel('Password'), null, null, (bool) $this->ID);
$password->setCanBeEmpty(true);
$fields = FieldList::create(TextField::create('FirstName', $member->fieldLabel('FirstName')), TextField::create('Surname', $member->fieldLabel('Surname')), EmailField::create('Email', $member->fieldLabel('Email')), $password);
$actions = FieldList::create($update = FormAction::create('updateprofile', 'Update'));
$form = Form::create($this, 'UpdateForm', $fields, $actions);
$form->loadDataFrom($member);
$this->extend('updateProfileDashletForm', $form);
return $form;
}
return;
}
开发者ID:spekulatius,项目名称:silverstripe-frontend-dashboards,代码行数:30,代码来源:UserProfileDashlet.php
示例13: getCMSFields
/**
* Returns a FieldList with which to create the main editing form.
*
* @return FieldList The fields to be displayed in the CMS.
*/
public function getCMSFields()
{
// Get the CMS fields
$fields = parent::getCMSFields();
// Update the existing fields with labels
$nameField = $fields->dataFieldByName("Title");
if ($nameField) {
$nameField->setRightTitle("Staff members name (John Smith etc)");
}
// Add the fields to the CMS
$fields->addFieldToTab("Root.Main", TextField::create("Position", _t("StaffProfilePage.PositionTitle", "Position")), "Content");
$fields->addFieldToTab("Root.Main", EmailField::create("Email", _t("StaffProfilePage.EmailTitle", "Email address")), "Content");
$fields->addFieldToTab("Root.Main", TextField::create("Phone", _t("StaffProfilePage.PhoneTitle", "Phone")), "Content");
$fields->addFieldToTab("Root.Categories", GridField::create("Categories", _t("StaffProfilePage.CategoriesTitle", "Categories"), $this->Categories(), StaffProfilePage_Category::getGridFieldConfig()));
// Add the thumbnail field
$uploadField = UploadField::create("Thumbnail", _t("StaffProfilePage.ThumbnailTitle", "Thumbnail"));
$uploadField->setFolderName('Staff');
$uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
$sizeMB = 0.3;
// MB
$size = $sizeMB * 1024 * 1024;
// Bytes
$uploadField->getValidator()->setAllowedMaxFileSize($size);
$fields->addFieldToTab("Root.Main", $uploadField, "Content");
$this->extend('updateCMSFields', $fields);
return $fields;
}
开发者ID:linkdup,项目名称:silverstripe-staffprofiles,代码行数:32,代码来源:StaffProfilePage.php
示例14: __construct
/**
* RegistrationForm constructor
*
* @param Controller $controller
* @param String $name
* @param array $arguments
*/
public function __construct($controller, $name, $arguments = array())
{
/** -----------------------------------------
* Fields
* ----------------------------------------*/
/** @var TextField $firstName */
$firstName = TextField::create('FirstName');
$firstName->setAttribute('placeholder', 'Enter your first name')->setAttribute('data-parsley-required-message', 'Please enter your <strong>First Name</strong>')->setCustomValidationMessage('Please enter your <strong>First Name</strong>');
/** @var EmailField $email */
$email = EmailField::create('Email');
$email->setAttribute('placeholder', 'Enter your email address')->setAttribute('data-parsley-required-message', 'Please enter your <strong>Email</strong>')->setCustomValidationMessage('Please enter your <strong>Email</strong>');
/** @var PasswordField $password */
$password = PasswordField::create('Password');
$password->setAttribute('placeholder', 'Enter your password')->setCustomValidationMessage('Please enter your <strong>Password</strong>')->setAttribute('data-parsley-required-message', 'Please enter your <strong>Password</strong>');
$fields = FieldList::create($email, $password);
/** -----------------------------------------
* Actions
* ----------------------------------------*/
$actions = FieldList::create(FormAction::create('Register')->setTitle('Register')->addExtraClass('btn--primary'));
/** -----------------------------------------
* Validation
* ----------------------------------------*/
$required = RequiredFields::create('FirstName', 'Email', 'Password');
/** @var Form $form */
$form = Form::create($this, $name, $fields, $actions, $required);
if ($formData = Session::get('FormInfo.Form_' . $name . '.data')) {
$form->loadDataFrom($formData);
}
parent::__construct($controller, $name, $fields, $actions, $required);
$this->setAttribute('data-parsley-validate', true);
$this->addExtraClass('form form--registration');
}
开发者ID:helpfulrobot,项目名称:ryanpotter-silverstripe-boilerplate,代码行数:39,代码来源:RegistrationForm.php
示例15: __construct
public function __construct($controller, $name, $fields = null, $actions = null)
{
$fields = new FieldList($Email = EmailField::create('Email')->setTitle(_t('ContactForm.EMAIL', 'ContactForm.EMAIL')), $Name = TextField::create('Name')->setTitle(_t('ContactForm.NAME', 'ContactForm.NAME')), $Message = TextareaField::create('Message')->setTitle(_t('ContactForm.MESSAGE', 'ContactForm.MESSAGE')));
$actions = new FieldList($Submit = FormAction::create('doContact')->setTitle(_t('ContactForm.BUTTONSEND', 'ContactForm.BUTTONSEND')));
$Submit->addExtraClass('btn');
parent::__construct($controller, $name, $fields, $actions, new RequiredFields("Email", "Name", "Message"));
}
开发者ID:andrelohmann,项目名称:roof-for-refugees.org,代码行数:7,代码来源:ContactForm.php
示例16: __construct
public function __construct($controller, $name)
{
$member = Member::currentUser();
$requiredFields = null;
if ($member && $member->exists()) {
$fields = new FieldList();
$fields->add(new HeaderField('AddressHeader', _t('Addressable.ADDRESSHEADER', 'Avatar / Description')));
$uploadField = new UploadField('Avatar', 'Select avatar');
$uploadField->setCanAttachExisting(false);
$comment = new TextareaField('Description', 'Description*');
$email = EmailField::create('Email', _t('CheckoutField.EMAIL', 'Email'));
$fields->add($uploadField);
$fields->add($comment);
$fields->add($email);
$requiredFields = $member->getValidator();
$requiredFields->addRequiredField('Avatar', 'Description', 'Email');
} else {
$fields = new FieldList();
}
if (get_class($controller) == 'ChefAccountPage_Controller') {
$actions = new FieldList(new FormAction('submit', _t('MemberForm.SAVE', 'Save Changes')));
}
parent::__construct($controller, $name, $fields, $actions, $requiredFields);
if ($member) {
$member->Password = "";
//prevents password field from being populated with encrypted password data
$this->loadDataFrom($member);
}
if ($record = $controller->data()) {
$record->extend('updateChefAccountForm', $fields, $actions, $requiredFields);
}
}
开发者ID:8secs,项目名称:cocina,代码行数:32,代码来源:ChefAccountForm.php
示例17: __construct
public function __construct($controller, $name, $fields = null, $actions = null)
{
$fields = new FieldList($Nickname = TextField::create('Nickname')->setTitle(_t('Member.NICKNAME', 'Member.NICKNAME')), $Type = OptionsetField::create('Type')->setTitle(_t('Member.TYPE', 'Member.TYPE'))->setSource(array("refugee" => _t('Member.TYPEREFUGEESIGNUP', 'Member.TYPEREFUGEESIGNUP'), "hostel" => _t('Member.TYPEHOSTELSIGNUP', 'Member.TYPEHOSTELSIGNUP'), "donator" => _t('Member.TYPEDONATORSIGNUP', 'Member.TYPEDONATORSIGNUP'))), $Location = BootstrapGeoLocationField::create('Location')->setTitle(_t('Member.LOCATION', 'Member.LOCATION')), $Email = EmailField::create('Email')->setTitle(_t('Member.EMAIL', 'Member.EMAIL')), PasswordField::create('Password')->setTitle(_t('Member.PASSWORD', 'Member.PASSWORD')), LiteralField::create('Accept_TOS', _t('SignupForm.CONFIRMTOS', 'SignupForm.CONFIRMTOS')));
$Type->setRightTitle(_t('Member.TYPEDESCRIPTION', 'Member.TYPEDESCRIPTION'));
$Location->setRightTitle(_t('Member.LOCATIONDESCRIPTION', 'Member.LOCATIONDESCRIPTION'));
$actions = new FieldList($Submit = BootstrapLoadingFormAction::create('doSignup')->setTitle(_t('SignupForm.BUTTONSIGNUP', 'SignupForm.BUTTONSIGNUP')));
parent::__construct($controller, $name, $fields, $actions, new RequiredUniqueFields($required = array("Nickname", "Type", "Location", "Email", "Password"), $unique = array("Email" => _t('SignupForm.EMAILEXISTS', 'SignupForm.EMAILEXISTS')), $objectClass = 'Member'));
}
开发者ID:andrelohmann,项目名称:roof-for-refugees.org,代码行数:8,代码来源:SignupForm.php
示例18: getCMSFields
public function getCMSFields()
{
$this->beforeUpdateCMSFields(function ($fields) {
$fields->addFieldsToTab('Root.Main', array(Textfield::create('ContactName', 'Name'), TextField::create('Phone', 'Phone'), TextField::create('Mobile', 'Mobile'), TextField::create('Fax', 'Fax'), EmailField::create('Email', 'Email'), $website = TextField::create('Website', 'Website')));
$website->setRightTitle('e.g ' . Director::absoluteBaseURL());
});
return parent::getCMSFields();
}
开发者ID:helpfulrobot,项目名称:dnadesign-silverstripe-elemental,代码行数:8,代码来源:ElementContact.php
示例19: TypoForm
function TypoForm()
{
$array = array('green', 'yellow', 'blue', 'pink', 'orange');
$form = new Form($this, 'TestForm', $fields = FieldList::create(HeaderField::create('HeaderField1', 'HeaderField Level 1', 1), LiteralField::create('LiteralField', '<p>All fields up to EmailField are required and should be marked as such</p>'), TextField::create('TextField1', 'Text Field Example 1'), TextField::create('TextField2', 'Text Field Example 2'), TextField::create('TextField3', 'Text Field Example 3'), TextField::create('TextField4', ''), HeaderField::create('HeaderField2b', 'Field with right title', 2), $textAreaField = new TextareaField('TextareaField', 'Textarea Field'), EmailField::create('EmailField', 'Email address'), HeaderField::create('HeaderField2c', 'HeaderField Level 2', 2), DropdownField::create('DropdownField', 'Dropdown Field', array(0 => '-- please select --', 1 => 'test AAAA', 2 => 'test BBBB')), OptionsetField::create('OptionSF', 'Optionset Field', $array), CheckboxSetField::create('CheckboxSF', 'Checkbox Set Field', $array), CountryDropdownField::create('CountryDropdownField', 'Countries'), CurrencyField::create('CurrencyField', 'Bling bling', '$123.45'), HeaderField::create('HeaderField3', 'Other Fields', 3), NumericField::create('NumericField', 'Numeric Field '), DateField::create('DateField', 'Date Field'), DateField::create('DateTimeField', 'Date and Time Field'), CheckboxField::create('CheckboxField', 'Checkbox Field')), $actions = FieldList::create(FormAction::create('submit', 'Submit Button')), $requiredFields = RequiredFields::create('TextField1', 'TextField2', 'TextField3', 'ErrorField1', 'ErrorField2', 'EmailField', 'TextField3', 'RightTitleField', 'CheckboxField', 'CheckboxSetField'));
$textAreaField->setColumns(45);
$form->setMessage('warning message', 'warning');
return $form;
}
开发者ID:helpfulrobot,项目名称:sunnysideup-typography,代码行数:8,代码来源:Typography.php
示例20: ApplicationForm
public function ApplicationForm()
{
$fields = FieldList::create(TextField::create('Name', 'Full name'), EmailField::create('Email', 'Email address'), PhoneNumberField::create('Phone', 'Contact Phone number'), DropdownField::create('JobID', 'Which job are you applying for?', $this->AvailableJobs()->map('ID', 'Title'))->setEmptyString('(Select)'), TextareaField::create('Application', 'Enter your experience and skills'));
$actions = FieldList::create(FormAction::create('processApplication', 'Apply'));
$validator = RequiredFields::create(array('Name', 'Email', 'Phone', 'JobID', 'Application'));
$form = Form::create($this, 'ApplicationForm', $fields, $actions, $validator);
return $form;
}
开发者ID:Fr3dj,项目名称:training,代码行数:8,代码来源:JobPage.php
注:本文中的EmailField类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论