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
5a31f62c
Commit
5a31f62c
authored
May 26, 2013
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1979030
by marcingy, dawehner: Convert help_page() to a Controller.
parent
ce7ff5cd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
46 deletions
+54
-46
core/modules/help/help.admin.inc
core/modules/help/help.admin.inc
+0
-42
core/modules/help/help.module
core/modules/help/help.module
+1
-4
core/modules/help/help.routing.yml
core/modules/help/help.routing.yml
+6
-0
core/modules/help/lib/Drupal/help/Controller/HelpController.php
...odules/help/lib/Drupal/help/Controller/HelpController.php
+47
-0
No files found.
core/modules/help/help.admin.inc
deleted
100644 → 0
View file @
ce7ff5cd
<?php
/**
* @file
* Admin page callbacks for the help module.
*/
/**
* Page callback: Prints a page listing general help for a module.
*
* @param $name
* A module name to display a help page for.
*
* @see help_menu()
*/
function
help_page
(
$name
)
{
$output
=
''
;
if
(
module_hook
(
$name
,
'help'
))
{
$info
=
system_get_info
(
'module'
);
drupal_set_title
(
$info
[
$name
][
'name'
]);
$temp
=
module_invoke
(
$name
,
'help'
,
"admin/help#
$name
"
,
drupal_help_arg
());
if
(
empty
(
$temp
))
{
$output
.
=
t
(
"No help is available for module %module."
,
array
(
'%module'
=>
$info
[
$name
][
'name'
]));
}
else
{
$output
.
=
$temp
;
}
// Only print list of administration pages if the module in question has
// any such pages associated to it.
$admin_tasks
=
system_get_module_admin_tasks
(
$name
,
$info
[
$name
]);
if
(
!
empty
(
$admin_tasks
))
{
$links
=
array
();
foreach
(
$admin_tasks
as
$task
)
{
$links
[]
=
l
(
$task
[
'title'
],
$task
[
'link_path'
],
$task
[
'localized_options'
]);
}
$output
.
=
theme
(
'item_list'
,
array
(
'items'
=>
$links
,
'title'
=>
t
(
'@module administration pages'
,
array
(
'@module'
=>
$info
[
$name
][
'name'
]))));
}
}
return
$output
;
}
core/modules/help/help.module
View file @
5a31f62c
...
...
@@ -21,11 +21,8 @@ function help_menu() {
foreach
(
$modules
as
$module
)
{
$items
[
'admin/help/'
.
$module
]
=
array
(
'title'
=>
$module
,
'page callback'
=>
'help_page'
,
'page arguments'
=>
array
(
2
),
'access arguments'
=>
array
(
'access administration pages'
),
'route_name'
=>
'help_page'
,
'type'
=>
MENU_VISIBLE_IN_BREADCRUMB
,
'file'
=>
'help.admin.inc'
,
);
}
...
...
core/modules/help/help.routing.yml
View file @
5a31f62c
...
...
@@ -4,3 +4,9 @@ help_main:
_content
:
'
\Drupal\help\Controller\HelpController::helpMain'
requirements
:
_permission
:
'
access
administration
pages'
help_page
:
pattern
:
'
admin/help/{name}'
defaults
:
_content
:
'
\Drupal\help\Controller\HelpController::helpPage'
requirements
:
_permission
:
'
access
administration
pages'
core/modules/help/lib/Drupal/help/Controller/HelpController.php
View file @
5a31f62c
...
...
@@ -87,4 +87,51 @@ protected function helpLinksAsList() {
return
$output
;
}
/**
* Prints a page listing general help for a module.
*
* @param string $name
* A module name to display a help page for.
*
* @return array
* A render array as expected by drupal_render().
*/
public
function
helpPage
(
$name
)
{
$build
=
array
();
if
(
$this
->
moduleHandler
->
implementsHook
(
$name
,
'help'
))
{
$info
=
system_get_info
(
'module'
);
drupal_set_title
(
$info
[
$name
][
'name'
]);
$temp
=
$this
->
moduleHandler
->
invoke
(
$name
,
'help'
,
array
(
"admin/help#
$name
"
,
drupal_help_arg
()));
if
(
empty
(
$temp
))
{
$build
[
'top'
][
'#markup'
]
=
t
(
'No help is available for module %module.'
,
array
(
'%module'
=>
$info
[
$name
][
'name'
]));
}
else
{
$build
[
'top'
][
'#markup'
]
=
$temp
;
}
// Only print list of administration pages if the module in question has
// any such pages associated to it.
$admin_tasks
=
system_get_module_admin_tasks
(
$name
,
$info
[
$name
]);
if
(
!
empty
(
$admin_tasks
))
{
$links
=
array
();
foreach
(
$admin_tasks
as
$task
)
{
$link
=
$task
[
'localized_options'
];
$link
[
'href'
]
=
$task
[
'link_path'
];
$link
[
'title'
]
=
$task
[
'title'
];
$links
[]
=
$link
;
}
$build
[
'links'
][
'#links'
]
=
array
(
'#heading'
=>
array
(
'level'
=>
'h3'
,
'text'
=>
t
(
'@module administration pages'
,
array
(
'@module'
=>
$info
[
$name
][
'name'
])),
),
'#links'
=>
$links
,
);
}
}
return
$build
;
}
}
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