本文整理汇总了PHP中TextField::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP TextField::__construct方法的具体用法?PHP TextField::__construct怎么用?PHP TextField::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextField
的用法示例。
在下文中一共展示了TextField::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($name = '', $title = null, $value = '', $maxLength = null, $form = null)
{
parent::__construct($name, $title, $value, $maxLength, $form);
$this->setAttribute('class', 'text');
$this->setAttribute('type', 'text');
$this->setAttribute('data-type', 'input');
}
开发者ID:helpfulrobot,项目名称:nblum-silverstripe-customizableinputfield,代码行数:7,代码来源:CustomizableInputFieldPart.php
示例2: __construct
/**
* Returns an input field, class="text" and type="text" with an optional
* maxlength
*/
public function __construct($name, $title = null, $value = "")
{
if (count(func_get_args()) > 3) {
Deprecation::notice('3.0', 'Use setMaxLength() instead of constructor arguments', Deprecation::SCOPE_GLOBAL);
}
parent::__construct($name, $title, $value);
}
示例3: __construct
/**
* @author Jeff Ober
* @param string $label the field's text label
* @param int $size the field's size attribute
* @param int $max_length the maximum size in characters
* @param callback $hash_function a (string) function or array (instance, string method) callback
* @param array $validators a list of callbacks to validate the field data
* @param array $attributes a list of key/value pairs representing HTML attributes
**/
public function __construct($label, $size, $max_length, $hash_function, array $validators = array(), array $attributes = array())
{
$this->max_length = $max_length;
$this->hash_function = $hash_function;
$attributes['size'] = $size;
parent::__construct($label, $validators, $attributes);
}
示例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);
}
示例5:
/**
* Constructor saves the format difference. Timefields shouldn't
* have a problem with length as times can only be represented in on way.
*
* @param $name string The name of the field
* @param $title string The Title of the field
* @param $value string the value for the field
* @param $timeformat string The Time format in date php format e.g. G:ia
*/
function __construct($name, $title = null, $value = "", $timeformat = null)
{
parent::__construct($name, $title, $value);
if ($timeformat) {
$this->timeformat = $timeformat;
}
}
示例6: __construct
public function __construct($name, $title = null, $value = "", $extraAttributes = null, $maxLength = null, $form = null)
{
if (is_array($extraAttributes)) {
$this->extraAttributes = $extraAttributes;
}
parent::__construct($name, $title, $value, $maxLength, $form);
}
示例7: __construct
public function __construct($name, $title = null, $value = "", $form = null)
{
/*
$monthValue = '';
$yearValue = '';
if(strlen($this->value) == 4) {
$monthValue = substr($value, 0, 2);
$yearValue = "20".substr($value, 2, 2);
}
$this->children = new FieldList(
$monthField = new DropdownField(
"{$name}[month]",
"",
$this->makeSelectList($this->monthArray(), $monthValue)
),
$yearField = new DropdownField(
"{$name}[year]",
"",
$this->makeSelectList($this->yearArray(), $yearValue)
)
);
$monthField->addExtraClass("");
$yearField->addExtraClass("");
// disable auto complete
foreach($this->children as $child) {
$child->setAttribute('autocomplete', 'off');
}
*/
parent::__construct($name, $title, null, $form);
$this->setValue($value);
}
示例8:
function __construct($name, $restrictedField, $restrictedTable, $restrictedMessage, $title = null, $value = "", $maxLength = null)
{
$this->maxLength = $maxLength;
$this->restrictedField = $restrictedField;
$this->restrictedTable = $restrictedTable;
$this->restrictedMessage = $restrictedMessage;
parent::__construct($name, $title, $value);
}
示例9: __construct
public function __construct($name, $title = null, $value = '', $maxLength = null, $form = null)
{
parent::__construct($name, $title, $value, $maxLength, $form);
$this->setTemplate('CustomizableInputField');
$this->setAttribute('class', 'text');
$this->setAttribute('data-value', 'true');
$this->setAttribute('type', 'hidden');
}
开发者ID:helpfulrobot,项目名称:nblum-silverstripe-customizableinputfield,代码行数:8,代码来源:CustomizableInputFieldSet.php
示例10: __construct
public function __construct($name, $title = null, $value = '', $maxLength = null, $form = null)
{
parent::__construct($name, $title, $value, $maxLength, $form);
Requirements::javascript(TAGGABLE_DIR . '/assets/build/js/lib.js');
Requirements::javascript(TAGGABLE_DIR . '/assets/build/js/tagfield.js');
Requirements::css(TAGGABLE_DIR . '/assets/build/css/main.css');
$this->addExtraClass('text');
}
示例11: __construct
/**
* @param string $name
* @param null $title
* @param string $value
* @param null $form
*/
public function __construct($name, $title = null, $value = '', $form = null)
{
parent::__construct($name, $title, $value, 7, $form);
Requirements::css(SILVERSTRIPE_COLOR_FIELD . '/css/colorpicker.css');
Requirements::javascript(SILVERSTRIPE_COLOR_FIELD . '/javascript/lib/colorpicker.min.js');
Requirements::javascript(SILVERSTRIPE_COLOR_FIELD . '/javascript/colorpicker.init.js');
$this->addExtraClass('text');
}
示例12: __construct
public function __construct($name, $title, $restrictedField, $restrictedTable, $value = "", $maxLength = null, $validationURL = null, $restrictedRegex = null)
{
$this->maxLength = $maxLength;
$this->restrictedField = $restrictedField;
$this->restrictedTable = $restrictedTable;
$this->validateURL = $validationURL;
$this->restrictedRegex = $restrictedRegex;
parent::__construct($name, $title, $value);
}
开发者ID:helpfulrobot,项目名称:svandragt-silverstripe-ajaxuniquetextfield,代码行数:9,代码来源:AjaxUniqueTextField.php
示例13: __construct
/**
* SimpleCaptchaField constructor.
* @param string $name
* @param null $title
* @param string $form
*/
public function __construct($name, $title = null, $form)
{
Requirements::css(SIMPLE_FORM_CAPTCHA_DIR . '/css/form.css');
Requirements::javascript(SIMPLE_FORM_CAPTCHA_DIR . '/js/SimpleCaptchaField.js');
parent::__construct($name, $title, null, null, $form);
$formName = $form->getName();
$form->addExtraClass($formName);
Requirements::customScript(sprintf("var SIMPLECAPTCHAFORM = '%s'", $formName));
}
示例14: __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 = new WTTreeDropdownField("{$name}[Internal]", _t('HtmlEditorField.Internal', 'Internal'), 'SiteTree', 'ID', 'Title', true), $this->externalField = new TextField("{$name}[External]", _t('HtmlEditorField.URL', 'URL'), 'http://'), $this->emailField = new EmailField("{$name}[Email]", _t('HtmlEditorField.EMAIL', 'Email address')), $this->fileField = new WTTreeDropdownField("{$name}[File]", _t('HtmlEditorField.FILE', 'File'), 'File', 'ID', 'Title', true), $this->anchorField = new TextField("{$name}[Anchor]", 'Anchor (optional)'), $this->targetBlankField = new CheckboxField("{$name}[TargetBlank]", _t('HtmlEditorField.LINKOPENNEWWIN', 'Open link in a new window?')));
$this->anchorField->addExtraClass('no-hide');
$this->targetBlankField->addExtraClass('no-hide');
parent::__construct($name, $title, $value);
}
示例15: __construct
public function __construct($name, $title = null, $value = '', $maxLength = null, $form = null)
{
parent::__construct($name, $title, $value, $maxLength, $form);
Requirements::javascript(ABC_VENDOR_PATH . '/jquery.colorpicker/jquery.colorpicker.js');
Requirements::customScript(file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/' . ABC_PATH . '/javascript/ColourPickerField.js'));
Requirements::css(ABC_VENDOR_PATH . '/jquery.colorpicker/jquery.colorpicker.css');
Requirements::css(ABC_PATH . '/css/ColourPickerField.css');
$this->addExtraClass('text');
}