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


PHP EmailField::create方法代码示例

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


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

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

示例2: __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

示例3: __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

示例4: __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

示例5: __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

示例6: __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

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

示例8: __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

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

 public function CommentForm()
 {
     $form = Form::create($this, __FUNCTION__, FieldList::create(TextField::create('Name', '')->setAttribute('placeholder', 'Name*')->addExtraClass('form-control'), EmailField::create('Email', '')->setAttribute('placeholder', 'Email*')->addExtraClass('form-control'), TextareaField::create('Comment', '')->setAttribute('placeholder', 'Comment*')->addExtraClass('form-control')), FieldList::create(FormAction::create('handleComment', 'Post Comment')->setUseButtonTag(true)->addExtraClass('btn btn-default-color btn-lg')), RequiredFields::create('Name', 'Email', 'Comment'));
     $form->addExtraClass('form-style');
     $data = Session::get("FormData.{$form->getName()}.data");
     //using the tirnary operator if $data exist...
     return $data ? $form->loadDataFrom($data) : $form;
 }
开发者ID:lestercomia,项目名称:onering,代码行数:8,代码来源:ArticlePage.php

示例11: PersonalRegisterForm

 public function PersonalRegisterForm()
 {
     $fields = FieldList::create(array(EmailField::create('Email', '电子邮件'), ConfirmedPasswordField::create('Password', '密码'), TextField::create('FullName', '姓名'), TextField::create('IDCard', '身份证号码'), TextField::create('Phone', '联系电话'), DropdownField::create('OrganizationID', '所属单位名称', Organization::get()->map('ID', 'company_name'))->setEmptyString('请选择')));
     $actions = FieldList::create(array(FormAction::create('doRegisterPersonal', '提交')));
     $required = RequiredFields::create(array('Email', 'Password', 'FullName', 'IDCard', 'Phone', 'OrganizationID'));
     $form = new Form($this, __FUNCTION__, $fields, $actions, $required);
     return $form;
 }
开发者ID:jallen0927,项目名称:lytech,代码行数:8,代码来源:RegisterPage_Controller.php

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

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

示例14: __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

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


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