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


PHP FormField::setTitle方法代码示例

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


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

示例1: setTitle

 public function setTitle($title)
 {
     parent::setTitle($title);
     $this->passwordField->setTitle($title);
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:5,代码来源:ConfirmedPasswordField.php

示例2: baseTransform

 /**
  * 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;
 }
开发者ID:camfindlay,项目名称:silverstripe-translatable,代码行数:24,代码来源:Translatable.php

示例3: augmentMailChimpField

 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;
 }
开发者ID:helpfulrobot,项目名称:briceburg-silverstripe-mailchimp-flexiform,代码行数:58,代码来源:FlexiFormMailChimpHandler.php

示例4: updateFormField

 /**
  * 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);
     }
 }
开发者ID:camfindlay,项目名称:silverstripe-userforms,代码行数:31,代码来源:EditableFormField.php


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