You are here

function feeds_ui_plugin_form in Feeds 6

Same name and namespace in other branches
  1. 8.2 feeds_ui/feeds_ui.admin.inc \feeds_ui_plugin_form()
  2. 7.2 feeds_ui/feeds_ui.admin.inc \feeds_ui_plugin_form()
  3. 7 feeds_ui/feeds_ui.admin.inc \feeds_ui_plugin_form()

Build a form of plugins to pick from.

Parameters

$form_state: Form API form state array.

$importer: FeedsImporter object.

$type: Plugin type. One of 'fetcher', 'parser', 'processor'.

Return value

A Form API form definition.

1 string reference to 'feeds_ui_plugin_form'
feeds_ui_edit_page in feeds_ui/feeds_ui.admin.inc
Edit feed configuration.

File

feeds_ui/feeds_ui.admin.inc, line 415
Contains all page callbacks, forms and theming functions for Feeds administrative pages.

Code

function feeds_ui_plugin_form(&$form_state, $importer, $type) {
  $plugins = feeds_get_plugins_by_type($type);
  $form = array();
  $form['#importer'] = $importer;
  $form['#plugin_type'] = $type;
  foreach ($plugins as $key => $plugin) {
    $form['plugin_key'][$key] = array(
      '#type' => 'radio',
      '#parents' => array(
        'plugin_key',
      ),
      '#title' => check_plain($plugin['name']),
      '#description' => filter_xss(isset($plugin['help']) ? $plugin['help'] : $plugin['description']),
      '#return_value' => $key,
      '#default_value' => $plugin['handler']['class'] == get_class($importer->{$type}) ? $key : '',
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
    '#attributes' => array(
      'class' => 'feeds-ui-hidden-submit',
    ),
  );
  return $form;
}