Skip to content
GitLab
Explore
Sign in
project
drupal
Compare revisions
e0a0b76f827d46aeddc137ff5e65de23f057bc6e to 8.0-alpha6
Hide whitespace changes
Inline
Side-by-side
core/modules/aggregator/aggregator.views.inc
View file @
172cd265
...
...
@@ -3,8 +3,6 @@
/**
* @file
* Provides views data for aggregator.module.
*
* @ingroup views_module_handlers
*/
/**
...
...
core/modules/block/block.module
View file @
172cd265
...
...
@@ -109,9 +109,41 @@ function block_menu() {
'type'
=>
MENU_VISIBLE_IN_BREADCRUMB
,
'route_name'
=>
'block.admin_add'
,
);
// Block administration is tied to the theme and plugin definition so
// that the plugin can appropriately attach to this URL structure.
// @todo D8: Use dynamic % arguments instead of static, hard-coded theme names
// and plugin IDs to decouple the routes from these dependencies.
// @see http://drupal.org/node/1067408
foreach
(
list_themes
()
as
$key
=>
$theme
)
{
$items
[
"admin/structure/block/demo/
$key
"
]
=
array
(
'route_name'
=>
'block.admin_demo'
,
'type'
=>
MENU_CALLBACK
,
'theme callback'
=>
'_block_custom_theme'
,
'theme arguments'
=>
array
(
$key
),
);
}
return
$items
;
}
/**
* Theme callback: Uses the theme specified in the parameter.
*
* @param $theme
* The theme whose blocks are being configured. If not set, the default theme
* is assumed.
*
* @return
* The theme that should be used for the block configuration page, or NULL
* to indicate that the default theme should be used.
*
* @see block_menu()
*/
function
_block_custom_theme
(
$theme
=
NULL
)
{
// We return exactly what was passed in, to guarantee that the page will
// always be displayed using the theme whose blocks are being configured.
return
$theme
;
}
/**
* Implements hook_page_build().
*
...
...
core/modules/block/block.services.yml
View file @
172cd265
...
...
@@ -9,8 +9,3 @@ services:
factory_method
:
get
factory_service
:
cache_factory
arguments
:
[
block
]
theme.negotiator.block.admin_demo
:
class
:
Drupal\block\Theme\AdminDemoNegotiator
tags
:
-
{
name
:
theme_negotiator
,
priority
:
1000
}
core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php
View file @
172cd265
...
...
@@ -36,10 +36,10 @@
* admin_permission = "administer blocks",
* base_table = "custom_block",
* revision_table = "custom_block_revision",
* route_base_path = "admin/structure/block/custom-blocks/manage/{bundle}",
* links = {
* "canonical" = "custom_block.edit",
* "edit-form" = "custom_block.edit"
* "edit-form" = "custom_block.edit",
* "admin-form" = "custom_block.type_edit"
* },
* fieldable = TRUE,
* translatable = TRUE,
...
...
@@ -52,7 +52,8 @@
* },
* bundle_keys = {
* "bundle" = "type"
* }
* },
* bundle_entity_type = "custom_block_type"
* )
*/
class
CustomBlock
extends
ContentEntityBase
implements
CustomBlockInterface
{
...
...
core/modules/block/lib/Drupal/block/Theme/AdminDemoNegotiator.php
deleted
100644 → 0
View file @
e0a0b76f
<?php
/**
* @file
* Contains \Drupal\block\Theme\AdminDemoNegotiator.
*/
namespace
Drupal\block\Theme
;
use
Drupal\Core\Theme\ThemeNegotiatorInterface
;
use
Symfony\Cmf\Component\Routing\RouteObjectInterface
;
use
Symfony\Component\HttpFoundation\Request
;
/**
* Negotiates the theme for the block admin demo page via the URL.
*/
class
AdminDemoNegotiator
implements
ThemeNegotiatorInterface
{
/**
* {@inheritdoc}
*/
public
function
determineActiveTheme
(
Request
$request
)
{
// We return exactly what was passed in, to guarantee that the page will
// always be displayed using the theme whose blocks are being configured.
if
(
$request
->
attributes
->
get
(
RouteObjectInterface
::
ROUTE_NAME
)
==
'block.admin_demo'
)
{
return
$request
->
attributes
->
get
(
'theme'
);
}
}
}
core/modules/book/book.module
View file @
172cd265
...
...
@@ -696,28 +696,43 @@ function template_preprocess_book_navigation(&$variables) {
if
(
$book_link
[
'mlid'
])
{
$variables
[
'tree'
]
=
book_children
(
$book_link
);
$build
=
array
();
if
(
$prev
=
book_prev
(
$book_link
))
{
$prev_href
=
url
(
$prev
[
'href'
]);
drupal_add_html_head_link
(
array
(
'rel'
=>
'prev'
,
'href'
=>
$prev_href
));
$build
[
'#attached'
][
'drupal_add_html_head_link'
][][]
=
array
(
'rel'
=>
'prev'
,
'href'
=>
$prev_href
,
);
$variables
[
'prev_url'
]
=
$prev_href
;
$variables
[
'prev_title'
]
=
check_plain
(
$prev
[
'title'
]);
}
if
(
$book_link
[
'plid'
]
&&
$parent
=
book_link_load
(
$book_link
[
'plid'
]))
{
$parent_href
=
url
(
$parent
[
'link_path'
]);
drupal_add_html_head_link
(
array
(
'rel'
=>
'up'
,
'href'
=>
$parent_href
));
$build
[
'#attached'
][
'drupal_add_html_head_link'
][][]
=
array
(
'rel'
=>
'up'
,
'href'
=>
$parent_href
,
);
$variables
[
'parent_url'
]
=
$parent_href
;
$variables
[
'parent_title'
]
=
check_plain
(
$parent
[
'title'
]);
}
if
(
$next
=
book_next
(
$book_link
))
{
$next_href
=
url
(
$next
[
'href'
]);
drupal_add_html_head_link
(
array
(
'rel'
=>
'next'
,
'href'
=>
$next_href
));
$build
[
'#attached'
][
'drupal_add_html_head_link'
][][]
=
array
(
'rel'
=>
'next'
,
'href'
=>
$next_href
,
);
$variables
[
'next_url'
]
=
$next_href
;
$variables
[
'next_title'
]
=
check_plain
(
$next
[
'title'
]);
}
}
if
(
!
empty
(
$build
))
{
drupal_render
(
$build
);
}
$variables
[
'has_links'
]
=
FALSE
;
// Link variables to filter for values and set state of the flag variable.
$links
=
array
(
'prev_url'
,
'prev_title'
,
'parent_url'
,
'parent_title'
,
'next_url'
,
'next_title'
);
...
...
core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php
View file @
172cd265
...
...
@@ -320,9 +320,9 @@ public function getLangcodes() {
if
(
empty
(
$langcodes
))
{
$langcodes
=
array
();
// Collect languages included with CKEditor based on file listing.
$ckeditor_languages
=
new
\GlobIterator
(
DRUPAL_ROOT
.
'/core/assets/vendor/ckeditor/lang/*.js'
);
foreach
(
$ckeditor_languages
as
$language_file
)
{
$langcode
=
$language_file
->
getBase
name
(
'.js'
);
$ckeditor_languages
=
glob
(
DRUPAL_ROOT
.
'/core/assets/vendor/ckeditor/lang/*.js'
);
foreach
(
$ckeditor_languages
as
$language_file
name
)
{
$langcode
=
basename
(
$language_filename
,
'.js'
);
$langcodes
[
$langcode
]
=
$langcode
;
}
cache
(
'ckeditor.languages'
)
->
set
(
'langcodes'
,
$langcodes
);
...
...
core/modules/comment/comment.module
View file @
172cd265
...
...
@@ -1731,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",
...
...
@@ -48,7 +47,8 @@
* },
* links = {
* "canonical" = "comment.permalink",
* "edit-form" = "comment.edit_page"
* "edit-form" = "comment.edit_page",
* "admin-form" = "comment.bundle"
* }
* )
*/
...
...
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/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/config_translation/lib/Drupal/config_translation/ConfigFieldInstanceMapper.php
View file @
172cd265
...
...
@@ -23,13 +23,10 @@ class ConfigFieldInstanceMapper extends ConfigEntityMapper {
*/
public
function
getBaseRouteParameters
()
{
$parameters
=
parent
::
getBaseRouteParameters
();
// @todo All core content entity path placeholders can be fully filled in
// with an additional {bundle} value in their paths, but a more
// predictable solution would be ideal. See
// https://drupal.org/node/2134871
$base_entity_info
=
$this
->
entityManager
->
getDefinition
(
$this
->
pluginDefinition
[
'base_entity_type'
]);
// @todo Field instances have no method to return the bundle the instance is
// attached to. See https://drupal.org/node/2134861
$parameters
[
'bundle'
]
=
$this
->
entity
->
bundle
;
$parameters
[
$base_entity_info
[
'bundle_entity_type'
]
]
=
$this
->
entity
->
bundle
;
return
$parameters
;
}
...
...
core/modules/contact/contact.local_tasks.yml
0 → 100644
View file @
172cd265
contact.category_edit
:
title
:
'
Edit'
route_name
:
contact.category_edit
tab_root_id
:
contact.category_edit
core/modules/contact/contact.module
View file @
172cd265
...
...
@@ -67,10 +67,6 @@ function contact_menu() {
'title'
=>
'Edit contact category'
,
'route_name'
=>
'contact.category_edit'
,
);
$items
[
'admin/structure/contact/manage/%contact_category/edit'
]
=
array
(
'title'
=>
'Edit'
,
'type'
=>
MENU_DEFAULT_LOCAL_TASK
,
);
$items
[
'contact'
]
=
array
(
'title'
=>
'Contact'
,
...
...
core/modules/contact/contact.views.inc
View file @
172cd265
...
...
@@ -3,8 +3,6 @@
/**
* @file
* Provide views data for contact.module.
*
* @ingroup views_module_handlers
*/
/**
...
...
core/modules/contact/lib/Drupal/contact/Entity/Message.php
View file @
172cd265
...
...
@@ -26,10 +26,13 @@
* entity_keys = {
* "bundle" = "category"
* },
*
route_base_path = "admin/structure/contact/manage/{bundle}
",
*
bundle_entity_type = "contact_category
",
* fieldable = TRUE,
* bundle_keys = {
* "bundle" = "id"
* },
* links = {
* "admin-form" = "contact.category_edit"
* }
* )
*/
...
...
core/modules/content_translation/content_translation.module
View file @
172cd265
...
...
@@ -156,7 +156,7 @@ function content_translation_menu() {
if
(
content_translation_enabled
(
$entity_type
))
{
$path
=
_content_translation_link_to_router_path
(
$entity_type
,
$info
[
'links'
][
'canonical'
]);
$entity_position
=
count
(
explode
(
'/'
,
$path
))
-
1
;
$keys
=
array_flip
(
array
(
'load_arguments'
));
$keys
=
array_flip
(
array
(
'theme_callback'
,
'theme_arguments'
,
'load_arguments'
));
$menu_info
=
array_intersect_key
(
$info
[
'translation'
][
'content_translation'
],
$keys
)
+
array
(
'file'
=>
'content_translation.pages.inc'
);
$item
=
array
();
...
...
core/modules/contextual/contextual.module
View file @
172cd265
...
...
@@ -6,6 +6,21 @@
* Adds contextual links to perform actions related to elements on a page.
*/
/**
* Implements hook_menu().
*/
function
contextual_menu
()
{
// @todo Remove this menu item in http://drupal.org/node/1954892 when theme
// callbacks are replaced with something else.
$items
[
'contextual/render'
]
=
array
(
'route_name'
=>
'contextual.render'
,
'theme callback'
=>
'ajax_base_page_theme'
,
'type'
=>
MENU_CALLBACK
,
);
return
$items
;
}
/**
* Implements hook_toolbar().
*/
...
...
core/modules/contextual/contextual.routing.yml
View file @
172cd265
...
...
@@ -2,7 +2,5 @@ contextual.render:
path
:
'
/contextual/render'
defaults
:
_controller
:
'
\Drupal\contextual\ContextualController::render'
options
:
_theme
:
ajax_base_page
requirements
:
_permission
:
'
access
contextual
links'
Prev
1
2
3
4
5
6
…
9
Next