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
c2190c91
Commit
c2190c91
authored
12 years ago
by
Chris Leppanen
Browse files
Options
Downloads
Patches
Plain Diff
Issue #1001590 by tristanoneil, twistor, Bevan: Path alias mapping target.
parent
014c3053
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
plugins/FeedsNodeProcessor.inc
+18
-0
18 additions, 0 deletions
plugins/FeedsNodeProcessor.inc
plugins/FeedsTermProcessor.inc
+31
-0
31 additions, 0 deletions
plugins/FeedsTermProcessor.inc
with
49 additions
and
0 deletions
plugins/FeedsNodeProcessor.inc
+
18
−
0
View file @
c2190c91
...
@@ -219,6 +219,17 @@ class FeedsNodeProcessor extends FeedsProcessor {
...
@@ -219,6 +219,17 @@ class FeedsNodeProcessor extends FeedsProcessor {
$target_node
->
feeds
[
'suppress_import'
]
=
TRUE
;
$target_node
->
feeds
[
'suppress_import'
]
=
TRUE
;
}
}
break
;
break
;
case
'path_alias'
:
$target_node
->
path
=
array
();
// Check for existing aliases.
if
(
!
empty
(
$target_node
->
nid
))
{
if
(
$path
=
path_load
(
'node/'
.
$target_node
->
nid
))
{
$target_node
->
path
=
$path
;
}
}
$target_node
->
path
[
'alias'
]
=
$value
;
break
;
default
:
default
:
parent
::
setTargetElement
(
$source
,
$target_node
,
$target_element
,
$value
);
parent
::
setTargetElement
(
$source
,
$target_node
,
$target_element
,
$value
);
break
;
break
;
...
@@ -280,6 +291,13 @@ class FeedsNodeProcessor extends FeedsProcessor {
...
@@ -280,6 +291,13 @@ class FeedsNodeProcessor extends FeedsProcessor {
);
);
}
}
// If path is enabled expose path alias.
if
(
module_exists
(
'path'
))
{
$targets
[
'path_alias'
]
=
array
(
'name'
=>
t
(
'Path alias'
),
'description'
=>
t
(
'URL path alias of the node.'
),
);
}
// If the target content type is a Feed node, expose its source field.
// If the target content type is a Feed node, expose its source field.
if
(
$id
=
feeds_get_importer_id
(
$this
->
config
[
'content_type'
]))
{
if
(
$id
=
feeds_get_importer_id
(
$this
->
config
[
'content_type'
]))
{
...
...
This diff is collapsed.
Click to expand it.
plugins/FeedsTermProcessor.inc
+
31
−
0
View file @
c2190c91
...
@@ -174,6 +174,28 @@ class FeedsTermProcessor extends FeedsProcessor {
...
@@ -174,6 +174,28 @@ class FeedsTermProcessor extends FeedsProcessor {
}
}
}
}
/**
* Override setTargetElement to operate on a target item that is a taxonomy term.
*/
public
function
setTargetElement
(
FeedsSource
$source
,
$target_term
,
$target_element
,
$value
)
{
switch
(
$target_element
)
{
case
'path_alias'
:
$target_term
->
path
=
array
();
// Check for existing aliases.
if
(
!
empty
(
$target_term
->
tid
))
{
if
(
$path
=
path_load
(
'taxonomy/term/'
.
$target_term
->
tid
))
{
$target_term
->
path
=
$path
;
}
}
$target_term
->
path
[
'alias'
]
=
$value
;
break
;
default
:
parent
::
setTargetElement
(
$source
,
$target_term
,
$target_element
,
$value
);
break
;
}
}
/**
/**
* Return available mapping targets.
* Return available mapping targets.
*/
*/
...
@@ -205,6 +227,15 @@ class FeedsTermProcessor extends FeedsProcessor {
...
@@ -205,6 +227,15 @@ class FeedsTermProcessor extends FeedsProcessor {
'description'
=>
t
(
'Description of the taxonomy term.'
),
'description'
=>
t
(
'Description of the taxonomy term.'
),
),
),
);
);
// If path is enabled expose path alias.
if
(
module_exists
(
'path'
))
{
$targets
[
'path_alias'
]
=
array
(
'name'
=>
t
(
'Path alias'
),
'description'
=>
t
(
'URL path alias for the taxonomy term.'
),
);
}
// Let implementers of hook_feeds_term_processor_targets() add their targets.
// Let implementers of hook_feeds_term_processor_targets() add their targets.
try
{
try
{
self
::
loadMappers
();
self
::
loadMappers
();
...
...
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