class FeedsClientsParser in Web Service Clients 6
Same name and namespace in other branches
- 7 clients/clients_feeds/FeedsClientsParser.inc \FeedsClientsParser
Class definition for Common Syndication Parser.
Hierarchy
- class \FeedsConfigurable
- class \FeedsPlugin implements FeedsSourceInterface
- class \FeedsParser
- class \FeedsClientsParser
- class \FeedsParser
- class \FeedsPlugin implements FeedsSourceInterface
Expanded class hierarchy of FeedsClientsParser
2 string references to 'FeedsClientsParser'
- clients_feeds_feeds_plugins in clients/
clients_feeds/ clients_feeds.module - Implementation of hook_feeds_plugins().
- _clients_feeds_feeds_importer_default in clients/
clients_feeds/ clients_feeds.defaults.inc - Helper to implementation of hook_feeds_importer_default().
File
- clients/
clients_feeds/ FeedsClientsParser.inc, line 11 - Parser for clients. Contains source selector @todo work out how to make source selector work in fetcher
View source
class FeedsClientsParser extends FeedsParser {
/**
* Parses a raw string and returns a Feed object from it.
*/
public function parse(FeedsImportBatch $batch, FeedsSource $source) {
return $batch;
}
/**
* Build configuration form.
*/
public function configForm(&$form_state) {
$form = array();
$services = array();
foreach (clients_resources_load() as $rid => $source) {
$services[$rid] = $source['name'];
}
$form['source'] = array(
'#type' => 'select',
'#title' => t('Available resources'),
'#default_value' => $this->config['source'],
'#options' => $services,
'#description' => t('Choose a resource'),
);
return $form;
}
/**
* Define default configuration.
*/
public function configDefaults() {
return array(
'source' => '',
);
}
/**
* Return mapping sources.
*
* At a future point, we could expose data type information here,
* storage systems like Data module could use this information to store
* parsed data automatically in fields with a correct field type.
*/
public function getMappingSources() {
$resource = clients_resource_load((int) $this->config['source']);
return clients_fields($resource);
}
/**
* Source form.
*/
public function sourceForm($source_config) {
if ($this->config['source']) {
$form = array();
// value doesn't work for some reason so use hidden
$form['source'] = array(
'#type' => 'hidden',
'#value' => $this->config['source'],
);
$resource = clients_resource_load((int) $this->config['source']);
$source_config_info[] = array(
t('Name'),
$resource->name,
);
foreach ($resource->configuration['options'] as $field => $val) {
if (is_array($val)) {
$val = implode(', ', $val);
}
$source_config_info[] = array(
ucfirst($field),
$val,
);
}
$form['info'] = array(
'#value' => theme_table(array(
t('Resource'),
), $source_config_info),
);
return $form;
}
else {
return array();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FeedsClientsParser:: |
public | function |
Define default configuration. Overrides FeedsConfigurable:: |
|
FeedsClientsParser:: |
public | function |
Build configuration form. Overrides FeedsConfigurable:: |
|
FeedsClientsParser:: |
public | function |
Return mapping sources. Overrides FeedsParser:: |
|
FeedsClientsParser:: |
public | function |
Parses a raw string and returns a Feed object from it. Overrides FeedsParser:: |
|
FeedsClientsParser:: |
public | function |
Source form. Overrides FeedsPlugin:: |
|
FeedsConfigurable:: |
protected | property | ||
FeedsConfigurable:: |
protected | property | CTools export enabled status of this object. | |
FeedsConfigurable:: |
protected | property | ||
FeedsConfigurable:: |
protected | property | ||
FeedsConfigurable:: |
public | function | Similar to setConfig but adds to existing configuration. | 1 |
FeedsConfigurable:: |
public | function | Submission handler for configForm(). | 3 |
FeedsConfigurable:: |
public | function | Validation handler for configForm(). | 3 |
FeedsConfigurable:: |
public | function | Copy a configuration. | 1 |
FeedsConfigurable:: |
public | function | Determine whether this object is persistent and enabled. I. e. it is defined either in code or in the database and it is enabled. | 1 |
FeedsConfigurable:: |
public | function | Implementation of getConfig(). | 1 |
FeedsConfigurable:: |
public static | function | Instantiate a FeedsConfigurable object. | 1 |
FeedsConfigurable:: |
public | function | Set configuration. | 1 |
FeedsConfigurable:: |
public | function | Override magic method __get(). Make sure that $this->config goes through getConfig() | |
FeedsConfigurable:: |
public | function | Override magic method __isset(). This is needed due to overriding __get(). | |
FeedsParser:: |
public | function | Clear all caches for results for given source. | |
FeedsParser:: |
public | function | Get an element identified by $element_key of the given item. The element key corresponds to the values in the array returned by FeedsParser::getMappingSources(). | 1 |
FeedsPlugin:: |
public | function |
Returns TRUE if $this->sourceForm() returns a form. Overrides FeedsSourceInterface:: |
|
FeedsPlugin:: |
protected static | function | Loads on-behalf implementations from mappers/ directory. | |
FeedsPlugin:: |
public | function |
Save changes to the configuration of this object.
Delegate saving to parent (= Feed) which will collect
information from this object by way of getConfig() and store it. Overrides FeedsConfigurable:: |
|
FeedsPlugin:: |
public | function |
Implementation of FeedsSourceInterface::sourceDefaults(). Overrides FeedsSourceInterface:: |
1 |
FeedsPlugin:: |
public | function |
A source is being deleted. Overrides FeedsSourceInterface:: |
1 |
FeedsPlugin:: |
public | function |
Validation handler for sourceForm. Overrides FeedsSourceInterface:: |
2 |
FeedsPlugin:: |
public | function |
A source is being saved. Overrides FeedsSourceInterface:: |
1 |
FeedsPlugin:: |
protected | function |
Constructor. Overrides FeedsConfigurable:: |