本文整理汇总了PHP中FormField::Title方法的典型用法代码示例。如果您正苦于以下问题:PHP FormField::Title方法的具体用法?PHP FormField::Title怎么用?PHP FormField::Title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormField
的用法示例。
在下文中一共展示了FormField::Title方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPlaceHolder
/**
* @param FormField $f
* @param string $surfix
* @return static
*/
protected function setPlaceHolder(FormField $f, $surfix = '')
{
$str = $f->Title();
if ($surfix) {
$str .= " {$surfix}";
}
$f->setAttribute('placeholder', $str);
return $this;
}
示例2:
/**
* Create a new nullable field
* @param $valueField
* @return NullableField
*/
function __construct(FormField $valueField, $isNullLabel = null)
{
$this->valueField = $valueField;
$this->isNullLabel = $isNullLabel;
if (is_null($this->isNullLabel)) {
// Set a default label if one is not provided.
$this->isNullLabel = _t('NullableField.IsNullLabel', 'Is Null');
}
parent::__construct($valueField->getName(), $valueField->Title(), $valueField->Value(), $valueField->getForm(), $valueField->RightTitle());
$this->readonly = $valueField->isReadonly();
}
示例3: baseTransform
/**
* @param FormField $nonEditableField
* @param FormField $originalField
* @param string $fieldname
* @return CompositeField
*/
protected function baseTransform($nonEditableField, $originalField, $fieldname)
{
/** @var CompositeField $nonEditableField_holder */
$nonEditableField_holder = CompositeField::create($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;
}
示例4: __construct
/**
* Create a new nullable field
*
* @param FormField $valueField
* @param null|string $isNullLabel
*/
public function __construct(FormField $valueField, $isNullLabel = null)
{
$this->valueField = $valueField;
if (isset($isNullLabel)) {
$this->setIsNullLabel($isNullLabel);
} else {
$this->isNullLabel = _t('NullableField.IsNullLabel', 'Is Null');
}
parent::__construct($valueField->getName(), $valueField->Title(), $valueField->Value());
$this->setForm($valueField->getForm());
$this->setRightTitle($valueField->RightTitle());
$this->setReadonly($valueField->isReadonly());
}
示例5: transform
public function transform(FormField $field)
{
if (!$field instanceof GridField) {
throw new Exception(__CLASS__ . ' requires GridField FormField type.');
}
$title = $field->Title();
$list = $field->getList();
$config = $field->getConfig();
$result = MultiRecordField::create($field->getName(), $title, $list);
// Support: GridFieldExtensions (https://github.com/silverstripe-australia/silverstripe-gridfieldextensions)
$gridFieldAddNewMultiClass = $config->getComponentsByType('GridFieldAddNewMultiClass')->first();
if ($gridFieldAddNewMultiClass) {
$classes = $gridFieldAddNewMultiClass->getClasses($field);
$result->setModelClasses($classes);
}
return $result;
}
示例6: 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);
}
}
示例7: Title
public function Title()
{
$title = parent::Title();
// Remove this method override in 4.0
$decoded = Convert::xml2raw($title);
if ($decoded !== $title) {
Deprecation::notice('4.0', 'The FormAction title field should not be html encoded. Use buttonContent to set custom html instead');
return $decoded;
}
return $title;
}
示例8: Title
/**
* Returns the field label if showing captcha - used by templates.
*
* @return string Title if field is showing the captcha
*/
public function Title()
{
if ($this->getShowCaptcha()) {
return parent::Title();
}
}