You are here

public function views_plugin_argument_validate_node::options_form in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 modules/node/views_plugin_argument_validate_node.inc \views_plugin_argument_validate_node::options_form()

Provide the default form for setting options.

Overrides views_plugin_argument_validate::options_form

File

modules/node/views_plugin_argument_validate_node.inc, line 29
Definition of views_plugin_argument_validate_node.

Class

views_plugin_argument_validate_node
Validate whether an argument is an acceptable node.

Code

public function options_form(&$form, &$form_state) {
  $types = node_type_get_types();
  $options = array();
  foreach ($types as $type => $info) {
    $options[$type] = check_plain(t($info->name));
  }
  $form['types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types'),
    '#options' => $options,
    '#default_value' => $this->options['types'],
    '#description' => t('Choose one or more content types to validate with.'),
  );
  $form['access'] = array(
    '#type' => 'checkbox',
    '#title' => t('Validate user has access to the content'),
    '#default_value' => $this->options['access'],
  );
  $form['access_op'] = array(
    '#type' => 'radios',
    '#title' => t('Access operation to check'),
    '#options' => array(
      'view' => t('View'),
      'update' => t('Edit'),
      'delete' => t('Delete'),
    ),
    '#default_value' => $this->options['access_op'],
    '#dependency' => array(
      'edit-options-validate-options-node-access' => array(
        TRUE,
      ),
    ),
  );
  $form['nid_type'] = array(
    '#type' => 'select',
    '#title' => t('Filter value format'),
    '#options' => array(
      'nid' => t('Node ID'),
      'nids' => t('Node IDs separated by , or +'),
    ),
    '#default_value' => $this->options['nid_type'],
  );
}