Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
page_title
Commits
5f5bb315
Commit
5f5bb315
authored
May 08, 2012
by
Nicholas Thompson
Browse files
#1146632 - fixing WSOD issue with Views accessing a non present property in the object.
parent
c160d29c
Changes
1
Hide whitespace changes
Inline
Side-by-side
views_handler_field_node_page_title.inc
View file @
5f5bb315
...
...
@@ -10,21 +10,22 @@
* This is a copy from views_handler_field_node.inc in the Views module.
* Additions are commented inline.
*/
class
views_handler_field_node_page_title
extends
views_handler_field
{
class
views_handler_field_node_page_title
extends
views_handler_field_node
{
/**
*
Construc
to
r
t
o provide additional fields to add.
*
We need
to t
weak the init() - if we fallback to title, ensure title is in the query!
*/
function
construct
()
{
parent
::
construct
();
//$this->additional_fields['nid'] = 'nid';
// Page Title: Load the node title for later.
//$this->additional_fields['title'] = 'title';
if
(
module_exists
(
'translation'
))
{
$this
->
additional_fields
[
'language'
]
=
'language'
;
function
init
(
&
$view
,
&
$options
)
{
parent
::
init
(
$view
,
$options
);
if
(
!
empty
(
$this
->
options
[
'use_node_title'
]))
{
$this
->
additional_fields
[
'title'
]
=
array
(
'table'
=>
'node'
,
'field'
=>
'title'
);
}
}
/**
* Define out default options
*/
function
option_definition
()
{
$options
=
parent
::
option_definition
();
$options
[
'link_to_node'
]
=
array
(
'default'
=>
FALSE
);
...
...
@@ -65,7 +66,10 @@ class views_handler_field_node_page_title extends views_handler_field {
function
render_link
(
$data
,
$values
)
{
if
(
!
empty
(
$this
->
options
[
'link_to_node'
])
&&
$data
!==
NULL
&&
$data
!==
''
)
{
$this
->
options
[
'alter'
][
'make_link'
]
=
TRUE
;
$this
->
options
[
'alter'
][
'path'
]
=
"node/"
.
$values
->
{
$this
->
aliases
[
'nid'
]};
$key
=
isset
(
$this
->
aliases
[
'nid'
])
?
$this
->
aliases
[
'nid'
]
:
'nid'
;
$this
->
options
[
'alter'
][
'path'
]
=
"node/"
.
$values
->
{
$key
};
if
(
isset
(
$this
->
aliases
[
'language'
]))
{
$languages
=
language_list
();
if
(
isset
(
$languages
[
$values
->
{
$this
->
aliases
[
'language'
]}]))
{
...
...
@@ -81,7 +85,8 @@ class views_handler_field_node_page_title extends views_handler_field {
function
render
(
$values
)
{
if
(
empty
(
$values
->
{
$this
->
field_alias
})
&&
!
empty
(
$this
->
options
[
'use_node_title'
]))
{
return
$this
->
render_link
(
check_plain
(
$values
->
{
$this
->
aliases
[
'title'
]}),
$values
);
$key
=
isset
(
$this
->
aliases
[
'title'
])
?
$this
->
aliases
[
'title'
]
:
'title'
;
return
$this
->
render_link
(
check_plain
(
$values
->
{
$key
}),
$values
);
}
else
{
return
$this
->
render_link
(
check_plain
(
$values
->
{
$this
->
field_alias
}),
$values
);
...
...
Write
Preview
Supports
Markdown
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