You are here

public function FeedsClientsParser::sourceForm in Web Service Clients 7

Same name and namespace in other branches
  1. 6 clients/clients_feeds/FeedsClientsParser.inc \FeedsClientsParser::sourceForm()

Source form.

File

clients/clients_feeds/FeedsClientsParser.inc, line 62
Parser for clients. Contains source selector @todo work out how to make source selector work in fetcher

Class

FeedsClientsParser
Class definition for Common Syndication Parser.

Code

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();
  }
}