Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
d562cd4b
Commit
d562cd4b
authored
Sep 27, 2015
by
alexpott
Browse files
Issue
#2556767
by Berdir, Wim Leers: Remove placeholdering of node links
parent
f2c047c6
Changes
6
Hide whitespace changes
Inline
Side-by-side
core/modules/node/src/NodeViewBuilder.php
View file @
d562cd4b
...
...
@@ -41,7 +41,6 @@ public function buildComponents(array &$build, array $entities, array $displays,
$langcode
,
!
empty
(
$entity
->
in_preview
),
]],
'#create_placeholder'
=>
TRUE
,
);
}
...
...
core/modules/statistics/config/install/statistics.settings.yml
View file @
d562cd4b
...
...
@@ -2,3 +2,4 @@ access_log:
enabled
:
false
max_lifetime
:
259200
count_content_views
:
0
display_max_age
:
3600
core/modules/statistics/config/schema/statistics.schema.yml
View file @
d562cd4b
...
...
@@ -17,6 +17,9 @@ statistics.settings:
count_content_views
:
type
:
integer
label
:
'
Count
content
views'
display_max_age
:
type
:
integer
label
:
'
How
long
any
statistics
may
be
cached,
i.e.
the
refresh
interval'
block.settings.statistics_popular_block
:
type
:
block_settings
...
...
core/modules/statistics/src/Tests/StatisticsAdminTest.php
View file @
d562cd4b
...
...
@@ -47,6 +47,9 @@ class StatisticsAdminTest extends WebTestBase {
protected
function
setUp
()
{
parent
::
setUp
();
// Set the max age to 0 to simplify testing.
$this
->
config
(
'statistics.settings'
)
->
set
(
'display_max_age'
,
0
)
->
save
();
// Create Basic page node type.
if
(
$this
->
profile
!=
'standard'
)
{
$this
->
drupalCreateContentType
(
array
(
'type'
=>
'page'
,
'name'
=>
'Basic page'
));
...
...
@@ -89,6 +92,16 @@ function testStatisticsSettings() {
$this
->
drupalGet
(
'node/'
.
$this
->
testNode
->
id
());
$this
->
client
->
post
(
$stats_path
,
array
(
'form_params'
=>
$post
));
$this
->
assertText
(
'2 views'
,
'Node is viewed 2 times.'
);
// Increase the max age to test that nodes are no longer immediately
// updated, visit the node once more to populate the cache.
$this
->
config
(
'statistics.settings'
)
->
set
(
'display_max_age'
,
3600
)
->
save
();
$this
->
drupalGet
(
'node/'
.
$this
->
testNode
->
id
());
$this
->
assertText
(
'3 views'
,
'Node is viewed 3 times.'
);
$this
->
client
->
post
(
$stats_path
,
array
(
'form_params'
=>
$post
));
$this
->
drupalGet
(
'node/'
.
$this
->
testNode
->
id
());
$this
->
assertText
(
'3 views'
,
'Views counter was not updated.'
);
}
/**
...
...
core/modules/statistics/statistics.install
View file @
d562cd4b
...
...
@@ -71,3 +71,11 @@ function statistics_update_8001() {
}
}
}
/**
* Disable the Statistics module if the node module is not enabled.
*/
function
statistics_update_8002
()
{
// Set the new configuration setting for max age to the initial value.
\
Drupal
::
configFactory
()
->
getEditable
(
'statistics.settings'
)
->
set
(
'display_max_age'
,
3600
)
->
save
();
}
core/modules/statistics/statistics.module
View file @
d562cd4b
...
...
@@ -50,6 +50,7 @@ function statistics_node_view(array &$build, EntityInterface $node, EntityViewDi
*/
function
statistics_node_links_alter
(
array
&
$node_links
,
NodeInterface
$entity
,
array
&
$context
)
{
if
(
$context
[
'view_mode'
]
!=
'rss'
)
{
$node_links
[
'#cache'
][
'contexts'
][]
=
'user.permissions'
;
if
(
\
Drupal
::
currentUser
()
->
hasPermission
(
'view post access counter'
))
{
$statistics
=
statistics_get
(
$entity
->
id
());
if
(
$statistics
)
{
...
...
@@ -60,6 +61,7 @@ function statistics_node_links_alter(array &$node_links, NodeInterface $entity,
'#attributes'
=>
array
(
'class'
=>
array
(
'links'
,
'inline'
)),
);
}
$node_links
[
'#cache'
][
'max-age'
]
=
\
Drupal
::
config
(
'statistics.settings'
)
->
get
(
'display_max_age'
);
}
}
}
...
...
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