コード例 #1
0
 /**
  *CMS fields for configuring Pardot plugin 
  */
 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab("Root.Pardot", new LiteralField($name = "pardot_logo", $content = '<div class="field"><img src="/silverstripe-pardot/images/pardot-logo.png" height="50"></div>'));
     $fields->addFieldToTab("Root.Pardot", new EmailField("pardot_email", "Email Address"));
     $password_field = new PasswordField("new_pardot_password", "Password");
     $password_field->setAttribute('placeholder', '********');
     $fields->addFieldToTab("Root.Pardot", $password_field);
     $fields->addFieldToTab("Root.Pardot", new TextField("pardot_user_key", "User Key"));
     //option to select campaign available after they have connected
     if (PardotConfig::validApiCredentials()) {
         $fields->addFieldToTab("Root.Pardot", self::getCampaignCmsDropdown());
     } else {
         $fields->addFieldToTab("Root.Pardot", new LiteralField($name = "pardot_campaign", $content = '<p class="message bad"> No valid credentials</p>'));
         $fields->addFieldToTab("Root.Pardot", new LiteralField($name = "pardot_campaign", $content = '<p class="message notice"> Once you are connected, re-visit this page and select a campaign.</p>'));
     }
     $fields->addFieldToTab("Root.Pardot", new CheckboxField("pardot_https", "Use HTTPS?"));
     return $fields;
 }
コード例 #2
0
 /**
  * @return static
  */
 function RegistrationForm()
 {
     // Email
     $email = new EmailField('Email');
     $email->setAttribute('placeholder', _t('RegistrationPage.EmailPlaceholder', 'Enter your email address'))->setAttribute('required', 'required')->addExtraClass('form-control');
     // Password Conformation
     $password = new PasswordField('Password');
     $password->setAttribute('placeholder', _t('RegistrationPage.PasswordPlaceholder', 'Enter your password'))->setCustomValidationMessage(_t('RegistrationPage.PasswordValidationText', 'Your passwords do not match'), 'validation')->setAttribute('required', 'required')->addExtraClass('form-control');
     // Generate the fields
     $fields = new FieldList($email, $password);
     // Submit Button
     $action = new FormAction('Register', 'Register');
     $action->addExtraClass('btn btn-primary btn-lg');
     $actions = new FieldList($action);
     $validator = new RequiredFields('Email', 'Password');
     $form = Form::create($this, 'RegistrationForm', $fields, $actions, $validator);
     if ($formData = Session::get('FormInfo.Form_RegistrationForm.data')) {
         $form->loadDataFrom($formData);
     }
     return $form;
 }