You are here

public function AssetFeedsProcessor::configForm in Asset 7

Override parent::configForm().

File

modules/asset_feeds/AssetFeedsProcessor.inc, line 136
Class definition of AssetFeedsProcessor.

Class

AssetFeedsProcessor
Creates assets from feed items.

Code

public function configForm(&$form_state) {
  $types = asset_type_get_names();
  array_walk($types, 'check_plain');
  $form = parent::configForm($form_state);
  $form['asset_type'] = array(
    '#type' => 'select',
    '#title' => t('Asset type'),
    '#description' => t('Select the content type for the assets to be created. <strong>Note:</strong> Users with "import !feed_id feeds" permissions will be able to <strong>import</strong> assets of the type selected here regardless of the asset level permissions. Further, users with "clear !feed_id permissions" will be able to <strong>delete</strong> imported assets regardless of their asset level permissions.', array(
      '!feed_id' => $this->id,
    )),
    '#options' => $types,
    '#default_value' => $this->config['asset_type'],
  );
  $author = user_load($this->config['author']);
  $form['author'] = array(
    '#type' => 'textfield',
    '#title' => t('Author'),
    '#description' => t('Select the author of the assets to be created - leave empty to assign "anonymous".'),
    '#autocomplete_path' => 'user/autocomplete',
    '#default_value' => empty($author->name) ? 'anonymous' : check_plain($author->name),
  );
  $period = drupal_map_assoc(array(
    FEEDS_EXPIRE_NEVER,
    3600,
    10800,
    21600,
    43200,
    86400,
    259200,
    604800,
    2592000,
    2592000 * 3,
    2592000 * 6,
    31536000,
  ), 'feeds_format_expire');
  $form['expire'] = array(
    '#type' => 'select',
    '#title' => t('Expire assets'),
    '#options' => $period,
    '#description' => t("Select after how much time assets should be deleted. The asset's published date will be used for determining the asset's age, see Mapping settings."),
    '#default_value' => $this->config['expire'],
  );
  $form['update_existing']['#options'] = array(
    FEEDS_SKIP_EXISTING => 'Do not update existing assets',
    FEEDS_REPLACE_EXISTING => 'Replace existing assets',
    FEEDS_UPDATE_EXISTING => 'Update existing assets (slower than replacing them)',
  );
  return $form;
}