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
cfd1c3ae
Commit
cfd1c3ae
authored
Dec 26, 2013
by
alexpott
Browse files
Issue
#2149107
by longwave: "View" area handler in Views gives fatal error.
parent
c47f5c70
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/modules/views/lib/Drupal/views/Plugin/views/area/View.php
View file @
cfd1c3ae
...
...
@@ -107,7 +107,7 @@ public function render($empty = FALSE) {
if
(
!
empty
(
$this
->
options
[
'view_to_insert'
]))
{
list
(
$view_name
,
$display_id
)
=
explode
(
':'
,
$this
->
options
[
'view_to_insert'
]);
$view
=
$this
->
viewStorage
->
load
(
$view_name
);
$view
=
$this
->
viewStorage
->
load
(
$view_name
)
->
getExecutable
()
;
if
(
empty
(
$view
)
||
!
$view
->
access
(
$display_id
))
{
return
array
();
...
...
core/modules/views/lib/Drupal/views/Tests/Handler/AreaViewTest.php
0 → 100644
View file @
cfd1c3ae
<?php
/**
* @file
* Contains \Drupal\views\Tests\Handler\AreaViewTest.
*/
namespace
Drupal\views\Tests\Handler
;
use
Drupal\views\Tests\ViewUnitTestBase
;
use
Drupal\views\Views
;
/**
* Tests the view area handler.
*
* @see \Drupal\views\Plugin\views\area\View
*/
class
AreaViewTest
extends
ViewUnitTestBase
{
/**
* Modules to enable.
*
* @var array
*/
public
static
$modules
=
array
(
'user'
);
/**
* Views used by this test.
*
* @var array
*/
public
static
$testViews
=
array
(
'test_area_view'
,
'test_simple_argument'
);
/**
* {@inheritdoc}
*/
public
static
function
getInfo
()
{
return
array
(
'name'
=>
'Area: View'
,
'description'
=>
'Tests the view area handler.'
,
'group'
=>
'Views Handlers'
,
);
}
/**
* Tests the view area handler.
*/
public
function
testViewArea
()
{
$view
=
Views
::
getView
(
'test_area_view'
);
$this
->
executeView
(
$view
);
$output
=
$view
->
render
();
$output
=
drupal_render
(
$output
);
$this
->
assertTrue
(
strpos
(
$output
,
'view-test-simple-argument'
)
!==
FALSE
,
'The test view is correctly embedded.'
);
$view
->
destroy
();
$view
->
setArguments
(
array
(
27
));
$this
->
executeView
(
$view
);
$output
=
$view
->
render
();
$output
=
drupal_render
(
$output
);
$this
->
assertTrue
(
strpos
(
$output
,
'John'
)
===
FALSE
,
'The test view is correctly embedded with inherited arguments.'
);
$this
->
assertTrue
(
strpos
(
$output
,
'George'
)
!==
FALSE
,
'The test view is correctly embedded with inherited arguments.'
);
$view
->
destroy
();
}
}
core/modules/views/tests/modules/views_test_config/test_views/views.view.test_area_view.yml
0 → 100644
View file @
cfd1c3ae
base_table
:
views_test_data
core
:
'
8'
description
:
'
'
status
:
'
1'
display
:
default
:
display_options
:
defaults
:
fields
:
'
0'
pager
:
'
0'
pager_options
:
'
0'
sorts
:
'
0'
fields
:
id
:
field
:
id
id
:
id
relationship
:
none
table
:
views_test_data
plugin_id
:
numeric
provider
:
views_test_data
pager
:
options
:
offset
:
'
0'
type
:
none
pager_options
:
{
}
sorts
:
id
:
field
:
id
id
:
id
order
:
ASC
relationship
:
none
table
:
views_test_data
plugin_id
:
numeric
provider
:
views_test_data
header
:
view
:
field
:
view
id
:
view
table
:
views
view_to_insert
:
test_simple_argument:default
inherit_arguments
:
1
plugin_id
:
view
provider
:
views
display_plugin
:
default
display_title
:
Master
id
:
default
position
:
'
0'
label
:
'
'
id
:
test_area_view
tag
:
'
'
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