public function setTitle($title) { parent::setTitle($title); $this->passwordField->setTitle($title); }
/** * Transform a translatable field to show the field value from the default language * DataObject below the translated field. * * This is a fallback function which handles field types that aren't transformed by * $this->transform{FieldType} functions. * * @param FormField $nonEditableField The readonly field to contain the original value * @param FormField $originalField The original editable field containing the translated value * @return \CompositeField The transformed field */ protected function baseTransform($nonEditableField, $originalField) { $fieldname = $originalField->getName(); $nonEditableField_holder = new CompositeField($nonEditableField); $nonEditableField_holder->setName($fieldname . '_holder'); $nonEditableField_holder->addExtraClass('originallang_holder'); $nonEditableField->setValue($this->original->{$fieldname}); $nonEditableField->setName($fieldname . '_original'); $nonEditableField->addExtraClass('originallang'); $nonEditableField->setTitle(_t('Translatable_Transform.OriginalFieldLabel', 'Original {title}', 'Label for the original value of the translatable field.', array('title' => $originalField->Title()))); $nonEditableField_holder->insertBefore($originalField, $fieldname . '_original'); return $nonEditableField_holder; }
protected function augmentMailChimpField(FormField $field, string $component, FlexiFormMailChimpClient $client) { switch ($component) { case 'MailChimpSendWelcome': $field->setTitle('Send Welcome Email'); $field->description = 'flag to control whether the Welcome Email is sent. Has no effect if double opt-in is enabled.'; break; case 'MailChimpDoubleOptIn': $field->setTitle('Require Double Opt-In'); $field->description = 'flag to control whether a double opt-in confirmation message is sent, defaults to true. Abusing this may cause your account to be suspended.'; break; case 'MailChimpEmailField': $field->setTitle('Subscription Field'); $field->description = 'Used as the subscriber email. Must be an Email Field or subclass.'; break; case 'MailChimpEmailType': // @TODO ought to let user select preference through a form field [ similar to interest groups? ] $field->setTitle('Email Preference'); $field->description = 'email type preference for subscribers (html or text - defaults to html)'; break; case 'MailChimpApiKey': if ($client->isApiKeyValid()) { $field->description = 'This API Key is Valid.'; } else { if ($client->getApiKey() == '') { $field->description = 'Your MailChimp API Key. Found under Account Extras > Your API Keys'; } else { $field->description = 'This API Key is not Valid.'; } } $field->setTitle('MailChimp API Key'); break; case 'MailChimpListID': if ($lists = $client->getLists(array('limit' => 100, 'sort_field' => 'web'))) { $value = $field->Value(); $source = array('' => 'Please Select a List'); $field = new DropdownField($field->getName()); $field->description = 'Subscribers will be added to this list. Lists are refreshed every 10 minutes.'; if ($lists['total'] > 0) { foreach ($lists['data'] as $list) { $source[$list['id']] = $list['name']; } } $field->setValue($value); $field->setSource($source); } else { $field = $field->performReadonlyTransformation(); if (!$client->isApiKeyValid()) { $field->setValue('Invalid API Key'); } else { $field->setValue('Error loading Lists from your Account'); } } $field->setTitle('MailChimp List ID'); break; } return $field; }
/** * Updates a formfield with the additional metadata specified by this field * * @param FormField $field */ protected function updateFormField($field) { // set the error / formatting messages $field->setCustomValidationMessage($this->getErrorMessage()); // set the right title on this field if ($this->RightTitle) { // Since this field expects raw html, safely escape the user data prior $field->setRightTitle(Convert::raw2xml($this->RightTitle)); } // if this field is required add some if ($this->Required) { // Required validation can conflict so add the Required validation messages as input attributes $errorMessage = $this->getErrorMessage()->HTML(); $field->addExtraClass('requiredField'); $field->setAttribute('data-rule-required', 'true'); $field->setAttribute('data-msg-required', $errorMessage); if ($identifier = UserDefinedForm::config()->required_identifier) { $title = $field->Title() . " <span class='required-identifier'>" . $identifier . "</span>"; $field->setTitle($title); } } // if this field has an extra class if ($this->ExtraClass) { $field->addExtraClass($this->ExtraClass); } }