1 views_plugin_argument_validate_node.inc views_plugin_argument_validate_node::options_form(&$form, &$form_state)

Provide the default form for setting options.

Overrides views_plugin_argument_validate::options_form

File

core/modules/node/views/views_plugin_argument_validate_node.inc, line 22
Contains the 'node' argument validator plugin.

Class

views_plugin_argument_validate_node
Validate whether an argument is an acceptable node.

Code

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'],
    '#states' => array(
      'visible' => array(
        ':input[name="options[validate][options][node][access]"]' => array('checked' => 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'],
  );
}