You are here

function views_bulk_operations_fields_action_views_bulk_operations_form in Views Bulk Operations (VBO) 6

Same name and namespace in other branches
  1. 6.3 fields.action.inc \views_bulk_operations_fields_action_views_bulk_operations_form()

File

actions/fields.action.inc, line 549
Drupal action to set individual field values.

Code

function views_bulk_operations_fields_action_views_bulk_operations_form($options) {
  $form['php_code'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show PHP code area'),
    '#description' => t('Check this ON to show a textarea for each field to allow the user to write a PHP script that will populate the value of this field.'),
    '#default_value' => $options['php_code'],
  );
  $form['show_tokens'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show available tokens'),
    '#description' => t('Check this ON to show tokens that are available for replacement in text fields. Only works with Token module enabled.'),
    '#default_value' => $options['show_tokens'],
  );
  $fields = array(
    VBO_ACTION_FIELDS_ALL => t('- All fields -'),
  );
  foreach (node_get_types() as $type => $info) {
    foreach (_views_bulk_operations_fields_action_non_cck($type) as $field) {
      $fields[$field['field_name']] = $field['label'] . ' (' . $field['field_name'] . ')';
    }
  }
  foreach (content_fields() as $field) {
    $fields[$field['field_name']] = $field['widget']['label'] . ' (' . $field['field_name'] . ')';
  }
  if (empty($options['display_fields'])) {
    $options['display_fields'] = array(
      VBO_ACTION_FIELDS_ALL,
    );
  }
  $form['display_fields'] = array(
    '#type' => 'select',
    '#title' => t('Display fields'),
    '#options' => $fields,
    '#multiple' => TRUE,
    '#description' => t('Select which field(s) the action form should present to the user.'),
    '#default_value' => $options['display_fields'],
  );
  return $form;
}