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
79918b8f
Commit
79918b8f
authored
9 years ago
by
twistor
Committed by
Chris Leppanen
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue #2497507 by twistor: Pass plugin definition to FeedsPlugin objects
parent
ef104d07
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
plugins/FeedsPlugin.inc
+27
-7
27 additions, 7 deletions
plugins/FeedsPlugin.inc
with
27 additions
and
7 deletions
plugins/FeedsPlugin.inc
+
27
−
7
View file @
79918b8f
...
@@ -29,14 +29,16 @@ abstract class FeedsPlugin extends FeedsConfigurable implements FeedsSourceInter
...
@@ -29,14 +29,16 @@ abstract class FeedsPlugin extends FeedsConfigurable implements FeedsSourceInter
/**
/**
* Constructs a FeedsPlugin object.
* Constructs a FeedsPlugin object.
*
*
* A copy of FeedsConfigurable::__construct() that doesn't call
* configDefaults() so that we avoid circular dependencies.
*
* @param string $id
* @param string $id
* The plugin id.
* The importer id.
* @param array $plugin_definition
* The plugin definition.
*/
*/
protected
function
__construct
(
$id
,
array
$plugin_definition
)
{
protected
function
__construct
(
$id
)
{
$this
->
pluginDefinition
=
$plugin_definition
;
$this
->
id
=
$id
;
parent
::
__construct
(
$id
);
$this
->
export_type
=
FEEDS_EXPORT_NONE
;
$this
->
disabled
=
FALSE
;
}
}
/**
/**
...
@@ -54,7 +56,13 @@ abstract class FeedsPlugin extends FeedsConfigurable implements FeedsSourceInter
...
@@ -54,7 +56,13 @@ abstract class FeedsPlugin extends FeedsConfigurable implements FeedsSourceInter
static
$instances
=
array
();
static
$instances
=
array
();
if
(
!
isset
(
$instances
[
$class
][
$id
]))
{
if
(
!
isset
(
$instances
[
$class
][
$id
]))
{
$instances
[
$class
][
$id
]
=
new
$class
(
$id
,
$plugin_definition
);
$instance
=
new
$class
(
$id
);
// The ordering here is important. The plugin definition should be usable
// in getConfig().
$instance
->
setPluginDefinition
(
$plugin_definition
);
$instance
->
setConfig
(
$instance
->
configDefaults
());
$instances
[
$class
][
$id
]
=
$instance
;
}
}
return
$instances
[
$class
][
$id
];
return
$instances
[
$class
][
$id
];
...
@@ -80,6 +88,18 @@ abstract class FeedsPlugin extends FeedsConfigurable implements FeedsSourceInter
...
@@ -80,6 +88,18 @@ abstract class FeedsPlugin extends FeedsConfigurable implements FeedsSourceInter
return
$this
->
pluginDefinition
;
return
$this
->
pluginDefinition
;
}
}
/**
* Sets the plugin definition.
*
* This is protected since we're only using it in FeedsPlugin::instance().
*
* @param array $plugin_definition
* The plugin definition.
*/
protected
function
setPluginDefinition
(
array
$plugin_definition
)
{
$this
->
pluginDefinition
=
$plugin_definition
;
}
/**
/**
* Save changes to the configuration of this object.
* Save changes to the configuration of this object.
* Delegate saving to parent (= Feed) which will collect
* Delegate saving to parent (= Feed) which will collect
...
...
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