You are here

function views_bulk_operations_fields_action_views_bulk_operations_form in Views Bulk Operations (VBO) 6.3

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

File

./fields.action.inc, line 270
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 if you want 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'],
  );
  $fields = array(
    VBO_ACTION_FIELDS_ALL => t('- All fields -'),
  );
  foreach (content_fields() as $field) {
    $fields[$field['field_name']] = $field['widget']['label'] . ' (' . $field['field_name'] . ')';
  }

  /*
  foreach (node_get_types() as $type => $info) {
    foreach (_views_bulk_operations_fields_action_non_cck($type) as $field) {
      if (!isset($fields[$field['field_name']])) {
        $fields[$field['field_name']] = $field['widget']['label'] .' ('. $field['field_name'] .')';
      }
    }
  }
  */
  if (empty($options['display_fields'])) {
    $options['display_fields'] = 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;
}