Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
feeds
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
feeds
Commits
fafade6a
Commit
fafade6a
authored
8 years ago
by
twistor
Committed by
MegaChriz
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue #2382245 by MegaChriz, twistor: Added import links to the admin menu.
parent
3cd0b274
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
feeds.module
+63
-0
63 additions, 0 deletions
feeds.module
with
63 additions
and
0 deletions
feeds.module
+
63
−
0
View file @
fafade6a
...
...
@@ -845,6 +845,69 @@ function feeds_flush_caches() {
return
array
();
}
/**
* Implements hook_admin_menu_output_build().
*
* Shows available importers in the "Content" section of the admin menu.
* Requires the "admin_menu" module to be enabled.
*/
function
feeds_admin_menu_output_build
(
array
&
$content
)
{
// Add new top-level item to the menu.
if
(
!
isset
(
$content
[
'menu'
]))
{
return
;
}
$access
=
FALSE
;
foreach
(
feeds_enabled_importers
()
as
$importer_id
)
{
if
(
user_access
(
'administer feeds'
)
||
user_access
(
"import
$importer_id
feeds"
))
{
$access
=
TRUE
;
break
;
}
}
if
(
!
$access
)
{
return
;
}
$content
[
'menu'
][
'admin/content'
][
'admin/content/feeds_import'
]
=
array
(
'#title'
=>
t
(
'Import'
),
'#href'
=>
'import'
,
);
foreach
(
feeds_importer_load_all
()
as
$importer
)
{
$content
[
'menu'
][
'admin/content'
][
'admin/content/feeds_import'
][
$importer
->
id
]
=
array
(
'#title'
=>
t
(
$importer
->
config
[
'name'
]),
'#href'
=>
!
empty
(
$importer
->
config
[
'content_type'
])
?
'node/add/'
.
$importer
->
config
[
'content_type'
]
:
'import/'
.
check_plain
(
$importer
->
id
),
'#access'
=>
user_access
(
'administer feeds'
)
||
user_access
(
"import
$importer->id
feeds"
),
);
}
}
/**
* Implements hook_menu_local_tasks_alter().
*
* Adds "Import" link as local action on content overview page.
*/
function
feeds_menu_local_tasks_alter
(
&
$data
,
$router_item
,
$root_path
)
{
if
(
$root_path
==
'admin/content'
)
{
$data
[
'actions'
][
'output'
][]
=
array
(
'#theme'
=>
'menu_local_task'
,
'#link'
=>
array
(
'title'
=>
t
(
'Import'
),
'href'
=>
'import'
,
'localized_options'
=>
array
(
'attributes'
=>
array
(
'title'
=>
t
(
'Import'
),
),
),
),
'#access'
=>
feeds_page_access
(),
// Add weight so it appears after the local action "Add content".
'#weight'
=>
1
,
);
}
}
/**
* @}
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment