Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
17cd8920
Commit
17cd8920
authored
Aug 29, 2016
by
Nathaniel Catchpole
Browse files
Issue
#2783117
by eloiv: views.api.php variable $view->name does not exist
parent
d262018e
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/modules/views/views.api.php
View file @
17cd8920
...
...
@@ -701,7 +701,7 @@ function hook_views_pre_view(ViewExecutable $view, $display_id, array &$args) {
// Modify contextual filters for my_special_view if user has 'my special permission'.
$account
=
\
Drupal
::
currentUser
();
if
(
$view
->
name
==
'my_special_view'
&&
$account
->
hasPermission
(
'my special permission'
)
&&
$display_id
==
'public_display'
)
{
if
(
$view
->
id
()
==
'my_special_view'
&&
$account
->
hasPermission
(
'my special permission'
)
&&
$display_id
==
'public_display'
)
{
$args
[
0
]
=
'custom value'
;
}
}
...
...
@@ -744,7 +744,7 @@ function hook_views_post_build(ViewExecutable $view) {
// assumptions about both exposed filter settings and the fields in the view.
// Also note that this alter could be done at any point before the view being
// rendered.)
if
(
$view
->
name
==
'my_view'
&&
isset
(
$view
->
exposed_raw_input
[
'type'
])
&&
$view
->
exposed_raw_input
[
'type'
]
!=
'All'
)
{
if
(
$view
->
id
()
==
'my_view'
&&
isset
(
$view
->
exposed_raw_input
[
'type'
])
&&
$view
->
exposed_raw_input
[
'type'
]
!=
'All'
)
{
// 'Type' should be interpreted as content type.
if
(
isset
(
$view
->
field
[
'type'
]))
{
$view
->
field
[
'type'
]
->
options
[
'exclude'
]
=
TRUE
;
...
...
@@ -771,7 +771,7 @@ function hook_views_pre_execute(ViewExecutable $view) {
$account
=
\
Drupal
::
currentUser
();
if
(
count
(
$view
->
query
->
tables
)
>
2
&&
$account
->
hasPermission
(
'administer views'
))
{
drupal_set_message
(
t
(
'The view %view may be heavy to execute.'
,
array
(
'%view'
=>
$view
->
name
)),
'warning'
);
drupal_set_message
(
t
(
'The view %view may be heavy to execute.'
,
array
(
'%view'
=>
$view
->
id
()
)),
'warning'
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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