Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
02c173eb
Commit
02c173eb
authored
Dec 04, 2014
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2379595
by ricovandevin, tibbsa: node_help() broken for node add/edit form
parent
f72f1e81
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
1 deletion
+82
-1
core/modules/node/node.module
core/modules/node/node.module
+1
-1
core/modules/node/src/Tests/NodeHelpTest.php
core/modules/node/src/Tests/NodeHelpTest.php
+81
-0
No files found.
core/modules/node/node.module
View file @
02c173eb
...
...
@@ -121,7 +121,7 @@ function node_help($route_name, RouteMatchInterface $route_match) {
case
'entity.node.edit_form'
:
$node
=
$route_match
->
getParameter
(
'node'
);
$type
=
$node
->
getType
();
$type
=
NodeType
::
load
(
$node
->
getType
()
)
;
return
(
!
empty
(
$type
->
help
)
?
Xss
::
filterAdmin
(
$type
->
help
)
:
''
);
case
'node.add'
:
...
...
core/modules/node/src/Tests/NodeHelpTest.php
0 → 100644
View file @
02c173eb
<?php
/**
* @file
* Contains \Drupal\node\Tests\NodeHelpTest.
*/
namespace
Drupal\node\Tests
;
use
Drupal\simpletest\WebTestBase
;
/**
* Tests help functionality for nodes.
*
* @group node
*/
class
NodeHelpTest
extends
WebTestBase
{
/**
* Modules to enable.
*
* @var array.
*/
public
static
$modules
=
array
(
'block'
,
'node'
,
'help'
);
/**
* The name of the test node type to create.
*
* @var string
*/
protected
$testType
;
/**
* The test 'node help' text to be checked.
*
* @var string
*/
protected
$testText
;
/**
* {@inheritdoc}
*/
protected
function
setUp
()
{
parent
::
setUp
();
// Create user.
$admin_user
=
$this
->
drupalCreateUser
(
array
(
'administer content types'
,
'administer nodes'
,
'bypass node access'
,
));
$this
->
drupalLogin
(
$admin_user
);
$this
->
drupalPlaceBlock
(
'system_help_block'
);
$this
->
testType
=
'type'
;
$this
->
testText
=
t
(
'Help text to find on node forms.'
);
// Create content type.
$this
->
drupalCreateContentType
(
array
(
'type'
=>
$this
->
testType
,
'help'
=>
$this
->
testText
,
));
}
/**
* Verifies that help text appears on node add/edit forms.
*/
public
function
testNodeShowHelpText
()
{
// Check the node add form.
$this
->
drupalGet
(
'node/add/'
.
$this
->
testType
);
$this
->
assertResponse
(
200
);
$this
->
assertText
(
$this
->
testText
);
// Create node and check the node edit form.
$node
=
$this
->
drupalCreateNode
(
array
(
'type'
=>
$this
->
testType
));
$this
->
drupalGet
(
'node/'
.
$node
->
id
()
.
'/edit'
);
$this
->
assertResponse
(
200
);
$this
->
assertText
(
$this
->
testText
);
}
}
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