Skip to content
GitLab
Explore
Sign in
project
drupal
Compare revisions
744309f9f2d885559b45b06885c77352b506b2a9 to 8.0-alpha6
Hide whitespace changes
Inline
Side-by-side
core/modules/breakpoint/tests/themes/breakpoint_test_theme/config/breakpoint.breakpoint.theme.breakpoint_test_theme.wide.yml
0 → 100644
View file @
172cd265
id
:
theme.breakpoint_test_theme.wide
uuid
:
1561574d-99f8-48a6-b304-4e2b617673b2
name
:
wide
label
:
wide
mediaQuery
:
'
(min-width:
851px)'
source
:
breakpoint_test_theme
sourceType
:
theme
weight
:
2
multipliers
:
1x
:
1x
status
:
true
langcode
:
en
core/modules/breakpoint/tests/themes/breakpoint_test_theme/config/breakpoint.breakpoint_group.theme.breakpoint_test_theme.breakpoint_test_theme.yml
0 → 100644
View file @
172cd265
id
:
theme.breakpoint_test_theme.breakpoint_test_theme
uuid
:
94b96e6e-a032-4b29-8100-efd5bf854fd1
name
:
breakpoint_test_theme
label
:
'
Breakpoint
test
theme'
breakpoint_ids
:
-
theme.breakpoint_test_theme.mobile
-
theme.breakpoint_test_theme.narrow
-
theme.breakpoint_test_theme.wide
-
theme.breakpoint_test_theme.tv
source
:
breakpoint_test_theme
sourceType
:
theme
status
:
true
langcode
:
en
core/modules/breakpoint/tests/themes/breakpoint_test_theme/config/breakpoint.breakpoint_group.theme.breakpoint_test_theme.test.yml
0 → 100644
View file @
172cd265
id
:
theme.breakpoint_test_theme.test
uuid
:
fcc25180-7e18-4149-8962-98d706faa59a
name
:
test
label
:
'
Test
Theme'
breakpoint_ids
:
-
theme.breakpoint_test_theme.mobile
-
theme.breakpoint_test_theme.narrow
-
theme.breakpoint_test_theme.wide
source
:
breakpoint_test_theme
sourceType
:
theme
status
:
true
langcode
:
en
core/modules/breakpoint/tests/themes/breakpoint_test_theme/config/breakpoint_test_theme.breakpoint_groups.yml
deleted
100644 → 0
View file @
744309f9
test
:
label
:
Test Theme
breakpoints
:
-
mobile
-
narrow
-
wide
core/modules/breakpoint/tests/themes/breakpoint_test_theme/config/breakpoint_test_theme.breakpoints.yml
deleted
100644 → 0
View file @
744309f9
mobile
:
'
(min-width:
0px)'
narrow
:
'
(min-width:
560px)'
wide
:
'
(min-width:
851px)'
tv
:
'
only
screen
and
(min-width:
3456px)'
core/modules/comment/comment.admin.inc
View file @
172cd265
...
...
@@ -155,13 +155,15 @@ function comment_admin_overview($form, &$form_state, $arg) {
$links
=
array
();
$links
[
'edit'
]
=
array
(
'title'
=>
t
(
'edit'
),
'href'
=>
'comment/'
.
$comment
->
id
()
.
'/edit'
,
'route_name'
=>
'comment.edit_page'
,
'route_parameters'
=>
array
(
'comment'
=>
$comment
->
id
()),
'query'
=>
$destination
,
);
if
(
module_invoke
(
'content_translation'
,
'translate_access'
,
$comment
))
{
$links
[
'translate'
]
=
array
(
'title'
=>
t
(
'translate'
),
'href'
=>
'comment/'
.
$comment
->
id
()
.
'/translations'
,
'route_name'
=>
'content_translation.translation_overview_comment'
,
'route_parameters'
=>
array
(
'comment'
=>
$comment
->
id
()),
'query'
=>
$destination
,
);
}
...
...
core/modules/comment/comment.module
View file @
172cd265
...
...
@@ -1175,9 +1175,7 @@ function comment_load($cid, $reset = FALSE) {
* The number of new comments or FALSE if the user is not logged in.
*/
function
comment_num_new
(
$entity_id
,
$entity_type
,
$field_name
=
NULL
,
$timestamp
=
0
)
{
global
$user
;
if
(
$user
->
isAuthenticated
()
&&
\Drupal
::
moduleHandler
()
->
moduleExists
(
'history'
))
{
if
(
\Drupal
::
currentUser
()
->
isAuthenticated
()
&&
\Drupal
::
moduleHandler
()
->
moduleExists
(
'history'
))
{
// Retrieve the timestamp at which the current user last viewed this entity.
if
(
!
$timestamp
)
{
if
(
$entity_type
==
'node'
)
{
...
...
@@ -1733,3 +1731,20 @@ function comment_library_info() {
);
return
$libraries
;
}
/**
* #post_render_cache callback; replaces the placeholder with the comment form.
*
* @param array $context
* An array with the following keys:
* - entity_type: an entity type
* - entity_id: an entity ID
* - field_name: a comment field name
*
* @return array $element
* The updated $element.
*/
function
comment_replace_form_placeholder
(
array
$context
)
{
$entity
=
entity_load
(
$context
[
'entity_type'
],
$context
[
'entity_id'
]);
return
comment_add
(
$entity
,
$context
[
'field_name'
]);
}
core/modules/comment/comment.views.inc
View file @
172cd265
...
...
@@ -2,9 +2,7 @@
/**
* @file
* Provide views data and handlers for comment.module.
*
* @ingroup views_module_handlers
* Provide views data for comment.module.
*/
/**
...
...
core/modules/comment/lib/Drupal/comment/Entity/Comment.php
View file @
172cd265
...
...
@@ -36,7 +36,6 @@
* fieldable = TRUE,
* translatable = TRUE,
* render_cache = FALSE,
* route_base_path = "admin/structure/comments/manage/{bundle}",
* entity_keys = {
* "id" = "cid",
* "bundle" = "field_id",
...
...
@@ -47,8 +46,9 @@
* "bundle" = "field_id"
* },
* links = {
* "canonical" = "/comment/{comment}",
* "edit-form" = "/comment/{comment}/edit"
* "canonical" = "comment.permalink",
* "edit-form" = "comment.edit_page",
* "admin-form" = "comment.bundle"
* }
* )
*/
...
...
@@ -216,10 +216,10 @@ public function id() {
public
function
preSave
(
EntityStorageControllerInterface
$storage_controller
)
{
parent
::
preSave
(
$storage_controller
);
global
$u
ser
;
$user
=
\Drupal
::
currentU
ser
()
;
if
(
!
isset
(
$this
->
status
->
value
))
{
$this
->
status
->
value
=
user
_access
(
'skip comment approval'
)
?
COMMENT_PUBLISHED
:
COMMENT_NOT_PUBLISHED
;
$this
->
status
->
value
=
$
user
->
hasPermission
(
'skip comment approval'
)
?
COMMENT_PUBLISHED
:
COMMENT_NOT_PUBLISHED
;
}
if
(
$this
->
isNew
())
{
// Add the comment to database. This next section builds the thread field.
...
...
core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
View file @
172cd265
...
...
@@ -138,7 +138,24 @@ public function viewElements(FieldItemListInterface $items) {
if
(
$status
==
COMMENT_OPEN
&&
$comment_settings
[
'form_location'
]
==
COMMENT_FORM_BELOW
)
{
// Only show the add comment form if the user has permission.
if
(
$this
->
currentUser
->
hasPermission
(
'post comments'
))
{
$output
[
'comment_form'
]
=
comment_add
(
$entity
,
$field_name
);
// All users in the "anonymous" role can use the same form: it is fine
// for this form to be stored in the render cache.
if
(
$this
->
currentUser
->
isAnonymous
())
{
$output
[
'comment_form'
]
=
comment_add
(
$entity
,
$field_name
);
}
// All other users need a user-specific form, which would break the
// render cache: hence use a #post_render_cache callback.
else
{
$output
[
'comment_form'
]
=
array
(
'#type'
=>
'render_cache_placeholder'
,
'#callback'
=>
'comment_replace_form_placeholder'
,
'#context'
=>
array
(
'entity_type'
=>
$entity
->
entityType
(),
'entity_id'
=>
$entity
->
id
(),
'field_name'
=>
$field_name
),
);
}
}
}
...
...
core/modules/comment/lib/Drupal/comment/Tests/CommentNodeAccessTest.php
View file @
172cd265
...
...
@@ -46,6 +46,9 @@ function setUp() {
'node test view'
,
'skip comment approval'
,
));
// Set the author of the created node to the web_user uid.
$this
->
node
->
setAuthorId
(
$this
->
web_user
->
id
())
->
save
();
}
/**
...
...
core/modules/comment/lib/Drupal/comment/Tests/CommentNonNodeTest.php
View file @
172cd265
...
...
@@ -229,11 +229,11 @@ function testCommentFunctionality() {
));
$this
->
drupalLogin
(
$limited_user
);
// Test that default field exists.
$this
->
drupalGet
(
'
admin/structure/
entity
-
test/
manag
e/entity_test/fields'
);
$this
->
drupalGet
(
'entity
_
test/
structur
e/entity_test/fields'
);
$this
->
assertText
(
t
(
'Comment settings'
));
$this
->
assertLinkByHref
(
'
admin/structure/
entity
-
test/
manag
e/entity_test/fields/entity_test.entity_test.comment'
);
$this
->
assertLinkByHref
(
'entity
_
test/
structur
e/entity_test/fields/entity_test.entity_test.comment'
);
// Test widget hidden option is not visible when there's no comments.
$this
->
drupalGet
(
'
admin/structure/
entity
-
test/
manag
e/entity_test/entity-test/fields/entity_test.entity_test.comment'
);
$this
->
drupalGet
(
'entity
_
test/
structur
e/entity_test/entity-test/fields/entity_test.entity_test.comment'
);
$this
->
assertNoField
(
'edit-default-value-input-comment-und-0-status-0'
);
$this
->
drupalLogin
(
$this
->
admin_user
);
...
...
@@ -343,20 +343,20 @@ function testCommentFunctionality() {
'administer entity_test content'
,
));
$this
->
drupalLogin
(
$limited_user
);
$this
->
drupalGet
(
'
admin/structure/
entity
-
test/
manag
e/entity_test/fields/entity_test.entity_test.comment'
);
$this
->
drupalGet
(
'entity
_
test/
structur
e/entity_test/fields/entity_test.entity_test.comment'
);
$this
->
assertNoFieldChecked
(
'edit-default-value-input-comment-0-status-0'
);
$this
->
assertNoFieldChecked
(
'edit-default-value-input-comment-0-status-1'
);
$this
->
assertFieldChecked
(
'edit-default-value-input-comment-0-status-2'
);
// Test comment option change in field settings.
$edit
=
array
(
'default_value_input[comment][0][status]'
=>
COMMENT_CLOSED
);
$this
->
drupalPostForm
(
NULL
,
$edit
,
t
(
'Save settings'
));
$this
->
drupalGet
(
'
admin/structure/
entity
-
test/
manag
e/entity_test/fields/entity_test.entity_test.comment'
);
$this
->
drupalGet
(
'entity
_
test/
structur
e/entity_test/fields/entity_test.entity_test.comment'
);
$this
->
assertNoFieldChecked
(
'edit-default-value-input-comment-0-status-0'
);
$this
->
assertFieldChecked
(
'edit-default-value-input-comment-0-status-1'
);
$this
->
assertNoFieldChecked
(
'edit-default-value-input-comment-0-status-2'
);
// Add a new comment field.
$this
->
drupalGet
(
'
admin/structure/
entity
-
test/
manag
e/entity_test/fields'
);
$this
->
drupalGet
(
'entity
_
test/
structur
e/entity_test/fields'
);
$edit
=
array
(
'fields[_add_new_field][label]'
=>
'Foobar'
,
'fields[_add_new_field][field_name]'
=>
'foobar'
,
...
...
core/modules/comment/lib/Drupal/comment/Tests/CommentTranslationUITest.php
View file @
172cd265
...
...
@@ -155,7 +155,7 @@ protected function assertPublishedStatus() {
* Tests translate link on comment content admin page.
*/
function
testTranslateLinkCommentAdminPage
()
{
$this
->
admin_user
=
$this
->
drupalCreateUser
(
array_merge
(
parent
::
getTranslatorPermissions
(),
array
(
'access administration pages'
,
'administer comments'
)));
$this
->
admin_user
=
$this
->
drupalCreateUser
(
array_merge
(
parent
::
getTranslatorPermissions
(),
array
(
'access administration pages'
,
'administer comments'
,
'skip comment approval'
)));
$this
->
drupalLogin
(
$this
->
admin_user
);
$cid_translatable
=
$this
->
createEntity
(
array
(),
$this
->
langcodes
[
0
]);
...
...
core/modules/comment/lib/Drupal/comment/Tests/Views/CommentTestBase.php
View file @
172cd265
...
...
@@ -36,7 +36,7 @@ function setUp() {
// Add two users, create a node with the user1 as author and another node
// with user2 as author. For the second node add a comment from user1.
$this
->
account
=
$this
->
drupalCreateUser
();
$this
->
account
=
$this
->
drupalCreateUser
(
array
(
'skip comment approval'
)
);
$this
->
account2
=
$this
->
drupalCreateUser
();
$this
->
drupalLogin
(
$this
->
account
);
...
...
core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php
View file @
172cd265
...
...
@@ -76,7 +76,7 @@ function testList() {
$actual_operations
=
$controller
->
getOperations
(
$entity
);
// Sort the operations to normalize link order.
uasort
(
$actual_operations
,
'drupal_sort_weight'
);
$this
->
assertIdentical
(
$expected_operations
,
$actual_operations
);
$this
->
assertIdentical
(
$expected_operations
,
$actual_operations
,
'The operations are identical.'
);
// Test buildHeader() method.
$expected_items
=
array
(
...
...
@@ -149,7 +149,7 @@ function testList() {
$actual_operations
=
$controller
->
getOperations
(
$entity
);
// Sort the operations to normalize link order.
uasort
(
$actual_operations
,
'drupal_sort_weight'
);
$this
->
assertIdentical
(
$expected_operations
,
$actual_operations
);
$this
->
assertIdentical
(
$expected_operations
,
$actual_operations
,
'The operations are identical.'
);
}
/**
...
...
core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigQueryTest.php
View file @
172cd265
...
...
@@ -28,9 +28,6 @@
* "id" = "id",
* "label" = "label",
* "uuid" = "uuid"
* },
* links = {
* "edit-form" = "admin/structure/config_test/manage/{config_query_test}"
* }
* )
*
...
...
core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php
View file @
172cd265
...
...
@@ -35,7 +35,7 @@
* "status" = "status"
* },
* links = {
* "edit-form" = "
admin/structure/config_test/manage/{config_test}
"
* "edit-form" = "
config_test.entity
"
* }
* )
*/
...
...
core/modules/config_translation/config_translation.api.php
0 → 100644
View file @
172cd265
<?php
/**
* @file
* Hooks provided by the Configuration Translation module.
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Introduce dynamic translation tabs for translation of configuration.
*
* This hook augments MODULE.config_translation.yml as well as
* THEME.config_translation.yml files to collect dynamic translation mapper
* information. If your information is static, just provide such a YAML file
* with your module containing the mapping.
*
* Note that while themes can provide THEME.config_translation.yml files this
* hook is not invoked for themes.
*
* @param array $info
* An associative array of configuration mapper information. Use an entity
* name for the key (for entity mapping) or a unique string for configuration
* name list mapping. The values of the associative array are arrays
* themselves in the same structure as the *.configuration_translation.yml
* files.
*
* @see hook_config_translation_info_alter()
* @see \Drupal\config_translation\ConfigMapperManagerInterface
* @see \Drupal\config_translation\Routing\RouteSubscriber::routes()
*/
function
hook_config_translation_info
(
&
$info
)
{
$entity_manager
=
\Drupal
::
entityManager
();
$route_provider
=
\Drupal
::
service
(
'router.route_provider'
);
// If field UI is not enabled, the base routes of the type
// "field_ui.instance_edit_$entity_type" are not defined.
if
(
\Drupal
::
moduleHandler
()
->
moduleExists
(
'field_ui'
))
{
// Add fields entity mappers to all fieldable entity types defined.
foreach
(
$entity_manager
->
getDefinitions
()
as
$entity_type
=>
$entity_info
)
{
$base_route
=
NULL
;
try
{
$base_route
=
$route_provider
->
getRouteByName
(
'field_ui.instance_edit_'
.
$entity_type
);
}
catch
(
RouteNotFoundException
$e
)
{
// Ignore non-existent routes.
}
// Make sure entity type is fieldable and has a base route.
if
(
$entity_info
[
'fieldable'
]
&&
!
empty
(
$base_route
))
{
$info
[
$entity_type
.
'_fields'
]
=
array
(
'base_route_name'
=>
'field_ui.instance_edit_'
.
$entity_type
,
'entity_type'
=>
'field_instance'
,
'title'
=>
t
(
'!label field'
),
'class'
=>
'\Drupal\config_translation\ConfigFieldInstanceMapper'
,
'base_entity_type'
=>
$entity_type
,
'list_controller'
=>
'\Drupal\config_translation\Controller\ConfigTranslationFieldInstanceListController'
,
'weight'
=>
10
,
);
}
}
}
}
/**
* Alter existing translation tabs for translation of configuration.
*
* This hook is useful to extend existing configuration mappers with new
* configuration names, for example when altering existing forms with new
* settings stored elsewhere. This allows the translation experience to also
* reflect the compound form element in one screen.
*
* @param array $info
* An associative array of discovered configuration mappers. Use an entity
* name for the key (for entity mapping) or a unique string for configuration
* name list mapping. The values of the associative array are arrays
* themselves in the same structure as the *.configuration_translation.yml
* files.
*
* @see hook_translation_info()
* @see \Drupal\config_translation\ConfigMapperManagerInterface
*/
function
hook_config_translation_info_alter
(
&
$info
)
{
// Add additional site settings to the site information screen, so it shows
// up on the translation screen. (Form alter in the elements whose values are
// stored in this config file using regular form altering on the original
// configuration form.)
$info
[
'system.site_information_settings'
][
'names'
][]
=
'example.site.setting'
;
}
/**
* Alter config typed data definitions.
*
* Used to automatically generate translation forms, you can alter the typed
* data types representing each configuration schema type to change default
* labels or form element renderers.
*
* @param $definitions
* Associative array of configuration type definitions keyed by schema type
* names. The elements are themselves array with information about the type.
*/
function
hook_config_translation_type_info_alter
(
&
$definitions
)
{
// Enhance the text and date type definitions with classes to generate proper
// form elements in ConfigTranslationFormBase. Other translatable types will
// appear as a one line textfield.
$definitions
[
'text'
][
'form_element_class'
]
=
'\Drupal\config_translation\FormElement\Textarea'
;
$definitions
[
'date_format'
][
'form_element_class'
]
=
'\Drupal\config_translation\FormElement\DateFormat'
;
}
/**
* @} End of "addtogroup hooks".
*/
core/modules/config_translation/config_translation.contextual_links.yml
0 → 100644
View file @
172cd265
config_translation.contextual_links
:
title
:
'
Translate
@type_name'
derivative
:
'
Drupal\config_translation\Plugin\Derivative\ConfigTranslationContextualLinks'
weight
:
100
core/modules/config_translation/config_translation.info.yml
0 → 100644
View file @
172cd265
name
:
'
Configuration
Translation'
type
:
module
description
:
'
Provides
a
translation
interface
for
configuration.'
package
:
Multilingual
version
:
VERSION
core
:
8.x
dependencies
:
-
locale
Prev
1
2
3
4
5
6
7
8
…
19
Next