You are here

function feeds_ui_plugin_form in Feeds 8.2

Same name and namespace in other branches
  1. 6 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 383
Contains all page callbacks, forms and theming functions for Feeds administrative pages.

Code

function feeds_ui_plugin_form($form, &$form_state, $importer, $type) {
  $plugins = FeedsPlugin::byType($type);
  $form['#importer'] = $importer->id;
  $form['#plugin_type'] = $type;
  $importer_key = $importer->config[$type]['plugin_key'];
  foreach ($plugins as $key => $plugin) {
    $form['plugin_key'][$key] = array(
      '#type' => 'radio',
      '#parents' => array(
        'plugin_key',
      ),
      '#title' => check_plain($plugin['title']),
      '#description' => filter_xss(isset($plugin['help']) ? $plugin['help'] : $plugin['description']),
      '#return_value' => $key,
      '#default_value' => $key == $importer_key ? $key : '',
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}