diff --git a/views_bulk_operations/actions/argument_selector.action.inc b/views_bulk_operations/actions/argument_selector.action.inc index 15a1b9e..d4ac87348 100644 --- a/views_bulk_operations/actions/argument_selector.action.inc +++ b/views_bulk_operations/actions/argument_selector.action.inc @@ -34,6 +34,12 @@ function views_bulk_operations_argument_selector_action($entities, $context = ar if (substr($base_url, -1, 1) != '/') { $base_url .= '/'; } + // Check for Wildcard variables in URL + $wildcard_pos = strpos($base_url, '%'); + if ($wildcard_pos !== FALSE) { + $arg_num = substr($base_url, $wildcard_pos + 1, 1); // Determine the wildcard position + $base_url = preg_replace('/%[0-9]/', arg($arg_num), $base_url); // Replace the URL with the wildcard variable. + } drupal_goto($base_url . $arguments); } @@ -41,7 +47,7 @@ function views_bulk_operations_argument_selector_action_views_bulk_operations_fo $form['url'] = array( '#title' => t('URL'), '#type' => 'textfield', - '#description' => t('Enter a URL that the user will be sent to. A comma-separated list of selected ids will be appended.'), + '#description' => t('Enter a URL that the user will be sent to. A comma-separated list of selected ids will be appended. You may use a single "%" in your URL to contextual filters from the current page: For example, the 514 value in the "view/514/feed" path would be represented by "%1".'), '#default_value' => isset($options['url']) ? $options['url'] : '', '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), );