depage-forms
v2.0.0
html forms made easy
Toggle main menu visibility
Loading...
Searching...
No Matches
Elements/Url.php
Go to the documentation of this file.
1
<?php
2
10
11
namespace
Depage\HtmlForm\Elements;
12
37
class
Url
extends
Text
38
{
48
protected
function
setDefaults
(): void
49
{
50
parent::setDefaults();
51
52
$this->defaults[
'errorMessage'
] = _(
'Please enter a valid URL'
);
53
54
// @todo add option to test url by domain name (dns) or also with a request (for http/https urls)
55
}
56
62
protected
function
typeCastValue
(): void
63
{
64
parent::typeCastValue();
65
66
if
($this->normalize) {
67
$this->value =
\Depage\HtmlForm\Validators\Url::normalizeUrl
($this->value);
68
}
69
}
70
76
protected
function
htmlValue
(): string
77
{
78
$value
= $this->value ===
null
? $this->defaultValue :
$this->value
;
79
$value
=
\Depage\HtmlForm\Validators\Url::humanReadableUrl
(
$value
);
80
81
return
$this->
htmlEscape
(
$value
);
82
}
83
}
84
85
/* vim:set ft=php sw=4 sts=4 fdm=marker et : */
Depage\HtmlForm\Abstracts\Element\htmlEscape
htmlEscape(array|string $options=[])
Escapes HTML in strings and arrays of strings.
Definition
Element.php:263
Depage\HtmlForm\Abstracts\Input\$value
$value
Input elements's value.
Definition
Input.php:124
Depage\HtmlForm\Elements\Text
HTML text input type.
Definition
Text.php:40
Depage\HtmlForm\Elements\Url
HTML url input-type.
Definition
Elements/Url.php:38
Depage\HtmlForm\Elements\Url\typeCastValue
typeCastValue()
Converts value into htmlDOM.
Definition
Elements/Url.php:62
Depage\HtmlForm\Elements\Url\htmlValue
htmlValue()
Returns the value of the element as HTML.
Definition
Elements/Url.php:76
Depage\HtmlForm\Elements\Url\setDefaults
setDefaults()
collects initial values across subclasses
Definition
Elements/Url.php:48
Depage\HtmlForm\Validators\Url\normalizeUrl
static normalizeUrl($url)
normalizes url
Definition
Validators/Url.php:33
Depage\HtmlForm\Validators\Url\humanReadableUrl
static humanReadableUrl($url)
changes encoded url to a human readable format
Definition
Validators/Url.php:66
Elements
Url.php
Generated on
for depage-forms by
doxygen
1.18.0
For an overview of all docs, go to
docs.depage.net