You are here

public function FeedsUserProcessor::rolesListFormCallback in Feeds 7.2

Mapping configuration form callback for target "roles_list".

File

plugins/FeedsUserProcessor.inc, line 526
Contains FeedsUserProcessor.

Class

FeedsUserProcessor
Feeds processor plugin. Create users from feed items.

Code

public function rolesListFormCallback(array $mapping, $target, array $form, array $form_state) {

  // Add in defaults.
  $defaults = $this
    ->rolesListDefaults();
  $mapping += $defaults;
  $mapping['allowed_roles'] += $defaults['allowed_roles'];
  $allowed_roles_options = user_roles(TRUE);
  unset($allowed_roles_options[DRUPAL_AUTHENTICATED_RID]);
  return array(
    'role_search' => array(
      '#type' => 'select',
      '#title' => t('Search roles by'),
      '#options' => $this
        ->rolesListRoleSearchOptions(),
      '#default_value' => $mapping['role_search'],
    ),
    'allowed_roles' => array(
      '#type' => 'checkboxes',
      '#title' => t('Allowed roles'),
      '#options' => $allowed_roles_options,
      '#default_value' => $mapping['allowed_roles'],
      '#description' => t('Select the roles to accept from the feed.<br />Any other roles will be ignored.'),
    ),
    'autocreate' => array(
      '#type' => 'checkbox',
      '#title' => t('Auto create'),
      '#description' => t("Create the role if it doesn't exist."),
      '#default_value' => $mapping['autocreate'],
    ),
    'revoke_roles' => array(
      '#type' => 'checkbox',
      '#title' => t('Revoke roles'),
      '#description' => t('If enabled, roles that are not provided by the feed will be revoked for the user. This affects only the "Allowed roles" as configured above.'),
      '#default_value' => $mapping['revoke_roles'],
    ),
  );
}