Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
221
Merge Requests
221
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
37cf78d2
Commit
37cf78d2
authored
Aug 24, 2015
by
catch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2555275
by dawehner: Fix missing schema for URI widget
parent
089e4f6b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
90 additions
and
4 deletions
+90
-4
core/config/schema/core.data_types.schema.yml
core/config/schema/core.data_types.schema.yml
+1
-1
core/config/schema/core.entity.schema.yml
core/config/schema/core.entity.schema.yml
+11
-0
core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UriItem.php
.../lib/Drupal/Core/Field/Plugin/Field/FieldType/UriItem.php
+5
-3
core/modules/field/src/Tests/Uri/UriItemTest.php
core/modules/field/src/Tests/Uri/UriItemTest.php
+73
-0
No files found.
core/config/schema/core.data_types.schema.yml
View file @
37cf78d2
...
...
@@ -491,7 +491,7 @@ field.value.string_long:
# Schema for the configuration of the URI field type.
field.storage_settings.uri
:
type
:
mapp
ing
type
:
field.storage_settings.str
ing
label
:
'
URI
settings'
mapping
:
max_length
:
...
...
core/config/schema/core.entity.schema.yml
View file @
37cf78d2
...
...
@@ -160,6 +160,17 @@ field.widget.settings.string_textarea:
type
:
label
label
:
'
Placeholder'
field.widget.settings.uri
:
type
:
mapping
label
:
'
URI
field'
mapping
:
size
:
type
:
integer
label
:
'
Size
of
URI
field'
placeholder
:
type
:
label
label
:
'
Placeholder'
field.widget.settings.email_default
:
type
:
mapping
label
:
'
Email
field
display
format
settings'
...
...
core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UriItem.php
View file @
37cf78d2
...
...
@@ -32,9 +32,11 @@ class UriItem extends StringItem {
* {@inheritdoc}
*/
public
static
function
defaultStorageSettings
()
{
return
array
(
'max_length'
=>
2048
,
)
+
parent
::
defaultStorageSettings
();
$storage_settings
=
parent
::
defaultStorageSettings
();
// is_ascii doesn't make sense for URIs.
unset
(
$storage_settings
[
'is_ascii'
]);
$storage_settings
[
'max_length'
]
=
2048
;
return
$storage_settings
;
}
/**
...
...
core/modules/field/src/Tests/Uri/UriItemTest.php
0 → 100644
View file @
37cf78d2
<?php
/**
* @file
* Contains \Drupal\field\Tests\Uri\UriItemTest.
*/
namespace
Drupal\field\Tests\Uri
;
use
Drupal\Component\Utility\Unicode
;
use
Drupal\field\Entity\FieldConfig
;
use
Drupal\field\Entity\FieldStorageConfig
;
use
Drupal\field\Tests\FieldUnitTestBase
;
/**
* Tests URI field functionality.
*
* @see \Drupal\Core\Field\Plugin\Field\FieldType\UriItem
*
* @group field
*/
class
UriItemTest
extends
FieldUnitTestBase
{
/**
* A field to use in this test class.
*
* @var \Drupal\field\Entity\FieldStorageConfig
*/
protected
$fieldStorage
;
/**
* The field used in this test class.
*
* @var \Drupal\field\Entity\FieldConfig
*/
protected
$field
;
/**
* Tests URI field.
*/
public
function
testUriField
()
{
$label
=
$this
->
randomMachineName
();
// Create a field with settings to validate.
$field_name
=
Unicode
::
strtolower
(
$this
->
randomMachineName
());
$this
->
fieldStorage
=
FieldStorageConfig
::
create
([
'field_name'
=>
$field_name
,
'entity_type'
=>
'entity_test'
,
'type'
=>
'uri'
,
]);
$this
->
fieldStorage
->
save
();
$this
->
field
=
FieldConfig
::
create
([
'field_name'
=>
$field_name
,
'entity_type'
=>
'entity_test'
,
'bundle'
=>
'entity_test'
,
'label'
=>
$label
,
'required'
=>
TRUE
,
'settings'
=>
[
'size'
=>
123
,
'placeholder'
=>
''
,
],
]);
$this
->
field
->
save
();
// Create a form display for the default form mode.
entity_get_form_display
(
'entity_test'
,
'entity_test'
,
'default'
)
->
setComponent
(
$field_name
,
[
'type'
=>
'uri'
,
])
->
save
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment