1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Feeds hooks implementations.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Implements hook_feeds_prevalidate().
|
10
|
*
|
11
|
* @see FeedsHooksTestCase::testPrevalidateHook()
|
12
|
*/
|
13
|
function feeds_tests_feeds_prevalidate(FeedsSource $source, $entity, $item, $entity_id) {
|
14
|
if (!variable_get('feeds_tests_hook_feeds_prevalidate', FALSE)) {
|
15
|
return;
|
16
|
}
|
17
|
|
18
|
// Keep track of results so far.
|
19
|
$results = variable_get('feeds_tests_hook_feeds_prevalidate_results', array());
|
20
|
$results[] = array(
|
21
|
'importer_id' => $source->importer->id,
|
22
|
'title' => $entity->title,
|
23
|
'item_guid' => $item['guid'],
|
24
|
'entity_id' => $entity_id,
|
25
|
);
|
26
|
variable_set('feeds_tests_hook_feeds_prevalidate_results', $results);
|
27
|
}
|
28
|
|
29
|
/**
|
30
|
* Implements hook_feeds_config_defaults().
|
31
|
*
|
32
|
* @see feeds_tests_form_feedsimporter_feeds_form_alter()
|
33
|
*/
|
34
|
function feeds_tests_feeds_config_defaults(FeedsConfigurable $configurable) {
|
35
|
if (!variable_get('feeds_tests_hook_config_defaults', FALSE)) {
|
36
|
return;
|
37
|
}
|
38
|
|
39
|
if ($configurable instanceof FeedsImporter) {
|
40
|
return array(
|
41
|
'feeds_tests_extra_setting' => FALSE,
|
42
|
);
|
43
|
}
|
44
|
}
|
45
|
|
46
|
/**
|
47
|
* Implements hook_feeds_PLUGIN_TYPE_config_defaults() for plugin 'fetcher'.
|
48
|
*
|
49
|
* @see feeds_tests_form_feedshttpfetcher_feeds_form_alter()
|
50
|
*/
|
51
|
function feeds_tests_feeds_fetcher_config_defaults(FeedsPlugin $plugin) {
|
52
|
if (!variable_get('feeds_tests_hook_config_defaults', FALSE)) {
|
53
|
return;
|
54
|
}
|
55
|
|
56
|
return array(
|
57
|
'feeds_tests_fetcher_extra_setting' => FALSE,
|
58
|
);
|
59
|
}
|
60
|
|
61
|
/**
|
62
|
* Implements hook_feeds_PLUGIN_TYPE_config_defaults() for plugin 'parser'.
|
63
|
*
|
64
|
* @see feeds_tests_form_feedscsvparser_feeds_form_alter()
|
65
|
*/
|
66
|
function feeds_tests_feeds_parser_config_defaults(FeedsPlugin $plugin) {
|
67
|
if (!variable_get('feeds_tests_hook_config_defaults', FALSE)) {
|
68
|
return;
|
69
|
}
|
70
|
|
71
|
return array(
|
72
|
'feeds_tests_parser_extra_setting' => TRUE,
|
73
|
);
|
74
|
}
|
75
|
|
76
|
/**
|
77
|
* Implements hook_feeds_PLUGIN_TYPE_config_defaults() for plugin 'processor'.
|
78
|
*
|
79
|
* @see feeds_tests_form_feedsnodeprocessor_feeds_form_alter()
|
80
|
*/
|
81
|
function feeds_tests_feeds_processor_config_defaults(FeedsPlugin $plugin) {
|
82
|
if (!variable_get('feeds_tests_hook_config_defaults', FALSE)) {
|
83
|
return;
|
84
|
}
|
85
|
|
86
|
return array(
|
87
|
'feeds_tests_processor_extra_setting' => '',
|
88
|
);
|
89
|
}
|