summaryrefslogtreecommitdiffstats
path: root/core/lib
diff options
context:
space:
mode:
Diffstat (limited to 'core/lib')
-rw-r--r--core/lib/Drupal/Core/Render/Element/Email.php2
-rw-r--r--core/lib/Drupal/Core/Render/Element/Password.php2
-rw-r--r--core/lib/Drupal/Core/Render/Element/Tel.php2
-rw-r--r--core/lib/Drupal/Core/Render/Element/Textfield.php4
-rw-r--r--core/lib/Drupal/Core/Render/Element/Url.php2
5 files changed, 11 insertions, 1 deletions
diff --git a/core/lib/Drupal/Core/Render/Element/Email.php b/core/lib/Drupal/Core/Render/Element/Email.php
index dce2a34..84bb352 100644
--- a/core/lib/Drupal/Core/Render/Element/Email.php
+++ b/core/lib/Drupal/Core/Render/Element/Email.php
@@ -11,12 +11,14 @@ use Drupal\Core\Render\Element;
* Properties:
* - #default_value: An RFC-compliant email address.
* - #size: The size of the input element in characters.
+ * - #pattern: A string for the native HTML5 pattern attribute.
*
* Example usage:
* @code
* $form['email'] = array(
* '#type' => 'email',
* '#title' => $this->t('Email'),
+ * '#pattern' => '*@example.com',
* );
* @end
*
diff --git a/core/lib/Drupal/Core/Render/Element/Password.php b/core/lib/Drupal/Core/Render/Element/Password.php
index 4ba2058..c40bb4c 100644
--- a/core/lib/Drupal/Core/Render/Element/Password.php
+++ b/core/lib/Drupal/Core/Render/Element/Password.php
@@ -10,6 +10,7 @@ use Drupal\Core\Render\Element;
*
* Properties:
* - #size: The size of the input element in characters.
+ * - #pattern: A string for the native HTML5 pattern attribute.
*
* Usage example:
* @code
@@ -17,6 +18,7 @@ use Drupal\Core\Render\Element;
* '#type' => 'password',
* '#title' => $this->t('Password'),
* '#size' => 25,
+ * '#pattern' => '[01]+',
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Tel.php b/core/lib/Drupal/Core/Render/Element/Tel.php
index 9289a1d..041f68a 100644
--- a/core/lib/Drupal/Core/Render/Element/Tel.php
+++ b/core/lib/Drupal/Core/Render/Element/Tel.php
@@ -12,12 +12,14 @@ use Drupal\Core\Render\Element;
*
* Properties:
* - #size: The size of the input element in characters.
+ * - #pattern: A string for the native HTML5 pattern attribute.
*
* Usage example:
* @code
* $form['phone'] = array(
* '#type' => 'tel',
* '#title' => $this->t('Phone'),
+ * '#pattern' => '[^\d]*',
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Textfield.php b/core/lib/Drupal/Core/Render/Element/Textfield.php
index 0bdc294..763646b 100644
--- a/core/lib/Drupal/Core/Render/Element/Textfield.php
+++ b/core/lib/Drupal/Core/Render/Element/Textfield.php
@@ -15,6 +15,7 @@ use Drupal\Core\Render\Element;
* autocomplete JavaScript library.
* - #autocomplete_route_parameters: An array of parameters to be used in
* conjunction with the route name.
+ * - #pattern: A string for the native HTML5 pattern attribute.
*
* Usage example:
* @code
@@ -24,7 +25,8 @@ use Drupal\Core\Render\Element;
* '#default_value' => $node->title,
* '#size' => 60,
* '#maxlength' => 128,
- * '#required' => TRUE,
+ * '#pattern' => 'some-prefix-[a-z]+',
+ * '#required' => TRUE,
* );
* @endcode
*
diff --git a/core/lib/Drupal/Core/Render/Element/Url.php b/core/lib/Drupal/Core/Render/Element/Url.php
index c3574b0..66e2141 100644
--- a/core/lib/Drupal/Core/Render/Element/Url.php
+++ b/core/lib/Drupal/Core/Render/Element/Url.php
@@ -12,6 +12,7 @@ use Drupal\Core\Render\Element;
* Properties:
* - #default_value: A valid URL string.
* - #size: The size of the input element in characters.
+ * - #pattern: A string for the native HTML5 pattern attribute.
*
* Usage example:
* @code
@@ -19,6 +20,7 @@ use Drupal\Core\Render\Element;
* '#type' => 'url',
* '#title' => $this->t('Home Page'),
* '#size' => 30,
+ * '#pattern' => '*.example.com',
* ...
* );
* @endcode