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
b422863d
Commit
b422863d
authored
14 years ago
by
Alex Barth
Browse files
Options
Downloads
Patches
Plain Diff
#849834 rbayliss, alex_b: Generalize feeds_config_form() to feeds_form().
parent
dffca3e2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.txt
+1
-0
1 addition, 0 deletions
CHANGELOG.txt
feeds.module
+2
-2
2 additions, 2 deletions
feeds.module
feeds_ui/feeds_ui.admin.inc
+5
-5
5 additions, 5 deletions
feeds_ui/feeds_ui.admin.inc
includes/FeedsConfigurable.inc
+37
-19
37 additions, 19 deletions
includes/FeedsConfigurable.inc
with
45 additions
and
26 deletions
CHANGELOG.txt
+
1
−
0
View file @
b422863d
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
Feeds 6.x 1.0 XXXXXXXXXXXXXXXXXX
Feeds 6.x 1.0 XXXXXXXXXXXXXXXXXX
--------------------------------
--------------------------------
- #849834 rbayliss, alex_b: Generalize feeds_config_form() to feeds_form().
- #907064 alex_b: Track imported terms.
- #907064 alex_b: Track imported terms.
- #906720 alex_b: Introduce a hook_feeds_after_clear().
- #906720 alex_b: Introduce a hook_feeds_after_clear().
- #905820 tristan.oneil: Adjust delete message in FeedsDataProcessor to avoid
- #905820 tristan.oneil: Adjust delete message in FeedsDataProcessor to avoid
...
...
This diff is collapsed.
Click to expand it.
feeds.module
+
2
−
2
View file @
b422863d
...
@@ -65,10 +65,10 @@ function feeds_perm() {
...
@@ -65,10 +65,10 @@ function feeds_perm() {
*/
*/
function
feeds_forms
()
{
function
feeds_forms
()
{
$forms
=
array
();
$forms
=
array
();
$forms
[
'FeedsImporter_feeds_
config_
form'
][
'callback'
]
=
'feeds_
config_
form'
;
$forms
[
'FeedsImporter_feeds_form'
][
'callback'
]
=
'feeds_form'
;
$plugins
=
feeds_get_plugins
();
$plugins
=
feeds_get_plugins
();
foreach
(
$plugins
as
$plugin
)
{
foreach
(
$plugins
as
$plugin
)
{
$forms
[
$plugin
[
'handler'
][
'class'
]
.
'_feeds_
config_
form'
][
'callback'
]
=
'feeds_
config_
form'
;
$forms
[
$plugin
[
'handler'
][
'class'
]
.
'_feeds_form'
][
'callback'
]
=
'feeds_form'
;
}
}
return
$forms
;
return
$forms
;
}
}
...
...
This diff is collapsed.
Click to expand it.
feeds_ui/feeds_ui.admin.inc
+
5
−
5
View file @
b422863d
...
@@ -308,13 +308,13 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') {
...
@@ -308,13 +308,13 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') {
ctools_include
(
'dependent'
);
ctools_include
(
'dependent'
);
if
(
empty
(
$plugin_key
))
{
if
(
empty
(
$plugin_key
))
{
$active_container
[
'title'
]
=
t
(
'Basic settings'
);
$active_container
[
'title'
]
=
t
(
'Basic settings'
);
$active_container
[
'body'
]
=
feeds_get_
config_
form
(
$importer
);
$active_container
[
'body'
]
=
feeds_get_form
(
$importer
,
'configForm'
);
}
}
// feeds_plugin_instance() returns a correct result because feed has been
// feeds_plugin_instance() returns a correct result because feed has been
// instantiated previously.
// instantiated previously.
elseif
(
in_array
(
$plugin_key
,
array_keys
(
$plugins
))
&&
$plugin
=
feeds_plugin_instance
(
$plugin_key
,
$importer
->
id
))
{
elseif
(
in_array
(
$plugin_key
,
array_keys
(
$plugins
))
&&
$plugin
=
feeds_plugin_instance
(
$plugin_key
,
$importer
->
id
))
{
$active_container
[
'title'
]
=
t
(
'Settings for !plugin'
,
array
(
'!plugin'
=>
$plugins
[
$plugin_key
][
'name'
]));
$active_container
[
'title'
]
=
t
(
'Settings for !plugin'
,
array
(
'!plugin'
=>
$plugins
[
$plugin_key
][
'name'
]));
$active_container
[
'body'
]
=
feeds_get_
config_
form
(
$plugin
);
$active_container
[
'body'
]
=
feeds_get_form
(
$plugin
,
'configForm'
);
}
}
break
;
break
;
case
'mapping'
:
case
'mapping'
:
...
@@ -354,7 +354,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') {
...
@@ -354,7 +354,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') {
// Fetcher.
// Fetcher.
$fetcher
=
$plugins
[
$config
[
'fetcher'
][
'plugin_key'
]];
$fetcher
=
$plugins
[
$config
[
'fetcher'
][
'plugin_key'
]];
$actions
=
array
();
$actions
=
array
();
if
(
feeds_get_
config_
form
(
$importer
->
fetcher
))
{
if
(
feeds_get_form
(
$importer
->
fetcher
,
'configForm'
))
{
$actions
=
array
(
l
(
t
(
'Settings'
),
$path
.
'/settings/'
.
$config
[
'fetcher'
][
'plugin_key'
]));
$actions
=
array
(
l
(
t
(
'Settings'
),
$path
.
'/settings/'
.
$config
[
'fetcher'
][
'plugin_key'
]));
}
}
$info
[
'title'
]
=
t
(
'Fetcher'
);
$info
[
'title'
]
=
t
(
'Fetcher'
);
...
@@ -371,7 +371,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') {
...
@@ -371,7 +371,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') {
// Parser.
// Parser.
$parser
=
$plugins
[
$config
[
'parser'
][
'plugin_key'
]];
$parser
=
$plugins
[
$config
[
'parser'
][
'plugin_key'
]];
$actions
=
array
();
$actions
=
array
();
if
(
feeds_get_
config_
form
(
$importer
->
parser
))
{
if
(
feeds_get_form
(
$importer
->
parser
,
'configForm'
))
{
$actions
=
array
(
l
(
t
(
'Settings'
),
$path
.
'/settings/'
.
$config
[
'parser'
][
'plugin_key'
]));
$actions
=
array
(
l
(
t
(
'Settings'
),
$path
.
'/settings/'
.
$config
[
'parser'
][
'plugin_key'
]));
}
}
$info
[
'title'
]
=
t
(
'Parser'
);
$info
[
'title'
]
=
t
(
'Parser'
);
...
@@ -388,7 +388,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') {
...
@@ -388,7 +388,7 @@ function feeds_ui_edit_page($importer, $active = 'help', $plugin_key = '') {
// Processor.
// Processor.
$processor
=
$plugins
[
$config
[
'processor'
][
'plugin_key'
]];
$processor
=
$plugins
[
$config
[
'processor'
][
'plugin_key'
]];
$actions
=
array
();
$actions
=
array
();
if
(
feeds_get_
config_
form
(
$importer
->
processor
))
{
if
(
feeds_get_form
(
$importer
->
processor
,
'configForm'
))
{
$actions
[]
=
l
(
t
(
'Settings'
),
$path
.
'/settings/'
.
$config
[
'processor'
][
'plugin_key'
]);
$actions
[]
=
l
(
t
(
'Settings'
),
$path
.
'/settings/'
.
$config
[
'processor'
][
'plugin_key'
]);
}
}
$actions
[]
=
l
(
t
(
'Mapping'
),
$path
.
'/mapping'
);
$actions
[]
=
l
(
t
(
'Mapping'
),
$path
.
'/mapping'
);
...
...
This diff is collapsed.
Click to expand it.
includes/FeedsConfigurable.inc
+
37
−
19
View file @
b422863d
...
@@ -178,31 +178,43 @@ abstract class FeedsConfigurable {
...
@@ -178,31 +178,43 @@ abstract class FeedsConfigurable {
*/
*/
public
function
configFormValidate
(
&
$values
)
{
public
function
configFormValidate
(
&
$values
)
{
}
}
/**
* Submission handler for configForm().
*
* @param $values
*/
public
function
configFormSubmit
(
&
$values
)
{
$this
->
addConfig
(
$values
);
$this
->
save
();
drupal_set_message
(
t
(
'Your changes have been saved.'
));
feeds_cache_clear
(
FALSE
);
}
}
}
/**
/**
* Config form wrapper. Use to render the configuration form of
* Config form wrapper. Use to render the configuration form of
* a FeedsConfigurable object.
* a FeedsConfigurable object.
*
*
* @param
* @param
$configurable
* FeedsConfigurable object.
* FeedsConfigurable object.
* @param
* @param
$form_method
* The
parent object to perform the save on
.
* The
form method that should be rendered
.
*
*
* @return
* @return
* Rendered config form, if available. Empty string otherwise.
* Rendered config form, if available. Empty string otherwise.
*/
*/
function
feeds_get_
config_
form
(
$configurable
)
{
function
feeds_get_form
(
$configurable
,
$form_method
)
{
$form_state
=
array
();
$form_state
=
array
();
if
(
$configurable
->
configForm
(
$form_state
))
{
if
(
method_exists
(
$configurable
,
$form_method
))
{
return
drupal_get_form
(
get_class
(
$configurable
)
.
'_feeds_
config_
form'
,
$configurable
);
return
drupal_get_form
(
get_class
(
$configurable
)
.
'_feeds_form'
,
$configurable
,
$form_method
);
}
}
return
''
;
return
''
;
}
}
/**
/**
* Config form callback. Don't call directly, but use
* Config form callback. Don't call directly, but use
* feeds_get_
config_
form($configurable) instead.
* feeds_get_form($configurable
, 'method'
) instead.
*
*
* @param
* @param
* FormAPI $form_state.
* FormAPI $form_state.
...
@@ -210,12 +222,15 @@ function feeds_get_config_form($configurable) {
...
@@ -210,12 +222,15 @@ function feeds_get_config_form($configurable) {
* FeedsConfigurable object.
* FeedsConfigurable object.
* @param
* @param
* The object to perform the save() operation on.
* The object to perform the save() operation on.
* @param $form_method
* The $form_method that should be rendered.
*/
*/
function
feeds_
config_
form
(
&
$form_state
,
$configurable
)
{
function
feeds_form
(
&
$form_state
,
$configurable
,
$form_method
)
{
$form
=
$configurable
->
configForm
(
$form_state
);
$form
=
$configurable
->
$form_method
(
$form_state
);
$form
[
'#configurable'
]
=
$configurable
;
$form
[
'#configurable'
]
=
$configurable
;
$form
[
'#validate'
]
=
array
(
'feeds_config_form_validate'
);
$form
[
'#feeds_form_method'
]
=
$form_method
;
$form
[
'#submit'
]
=
array
(
'feeds_config_form_submit'
);
$form
[
'#validate'
]
=
array
(
'feeds_form_validate'
);
$form
[
'#submit'
]
=
array
(
'feeds_form_submit'
);
$form
[
'submit'
]
=
array
(
$form
[
'submit'
]
=
array
(
'#type'
=>
'submit'
,
'#type'
=>
'submit'
,
'#value'
=>
t
(
'Save'
),
'#value'
=>
t
(
'Save'
),
...
@@ -225,18 +240,21 @@ function feeds_config_form(&$form_state, $configurable) {
...
@@ -225,18 +240,21 @@ function feeds_config_form(&$form_state, $configurable) {
}
}
/**
/**
* Validation handler for feeds_
config_
form().
* Validation handler for feeds_form().
*/
*/
function
feeds_config_form_validate
(
$form
,
&
$form_state
)
{
function
feeds_form_validate
(
$form
,
&
$form_state
)
{
$form
[
'#configurable'
]
->
configFormValidate
(
$form_state
[
'values'
]);
$validate_method
=
$form
[
'#feeds_form_method'
]
.
'Validate'
;
if
(
method_exists
(
$form
[
'#configurable'
],
$validate_method
))
{
$form
[
'#configurable'
]
->
$validate_method
(
$form_state
[
'values'
]);
}
}
}
/**
/**
* Submit handler for feeds_config_form().
* Submit handler for feeds_config_form().
*/
*/
function
feeds_
config_
form_submit
(
$form
,
&
$form_state
)
{
function
feeds_form_submit
(
$form
,
&
$form_state
)
{
$
form
[
'#configurable'
]
->
addConfig
(
$form_state
[
'values'
])
;
$
submit_method
=
$form
[
'#feeds_form_method'
]
.
'Submit'
;
$form
[
'#configurable'
]
->
save
();
if
(
method_exists
(
$form
[
'#configurable'
]
,
$submit_method
))
{
drupal_set_message
(
t
(
'Your changes have been saved.'
)
);
$form
[
'#configurable'
]
->
$submit_method
(
$form_state
[
'values'
]
);
feeds_cache_clear
(
FALSE
);
}
}
}
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