5 * Contains the raw value argument default plugin.
9 * Default argument plugin to use the raw value from the URL.
11 * @ingroup views_argument_default_plugins
13 class views_plugin_argument_default_raw extends views_plugin_argument_default {
14 function option_definition() {
15 $options = parent::option_definition();
16 $options['index'] = array('default' => '');
17 $options['use_alias'] = array('default' => FALSE, 'bool' => TRUE);
22 function options_form(&$form, &$form_state) {
23 parent::options_form($form, $form_state);
24 // Using range(1, 10) will create an array keyed 0-9, which allows arg() to
25 // properly function since it is also zero-based.
26 $form['index'] = array(
28 '#title' => t('Path component'),
29 '#default_value' => $this->options['index'],
30 '#options' => range(1, 10),
31 '#description' => t('The numbering starts from 1, e.g. on the page admin/structure/types, the 3rd path component is "types".'),
33 $form['use_alias'] = array(
34 '#type' => 'checkbox',
35 '#title' => t('Use path alias'),
36 '#default_value' => $this->options['use_alias'],
37 '#description' => t('Use path alias instead of internal path.'),
41 function get_argument() {
43 if ($this->options['use_alias']) {
44 $path = drupal_get_path_alias();
46 if ($arg = arg($this->options['index'], $path)) {