You are here

function rules_action_path_alias_form in Rules 6

Related topics

1 call to rules_action_path_alias_form()
rules_action_node_path_alias_form in rules/modules/path.rules_forms.inc

File

rules/modules/path.rules_forms.inc, line 63
Rules configuration forms for the path module

Code

function rules_action_path_alias_form($settings, &$form) {
  $settings += array(
    'dst' => '',
    'src' => '',
    'replace' => '-',
    'language' => '',
  );
  $form['settings']['src'] = array(
    '#type' => 'textfield',
    '#title' => t('Existing system path'),
    '#default_value' => $settings['src'],
    '#maxlength' => 256,
    '#description' => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.') . ' ' . t('Leave it empty to delete URL aliases pointing to the given path alias.'),
    '#field_prefix' => url('', array(
      'absolute' => TRUE,
    )) . (variable_get('clean_url', 0) ? '' : '?q='),
  );
  $form['settings']['dst'] = array(
    '#type' => 'textfield',
    '#title' => t('Path alias'),
    '#default_value' => $settings['dst'],
    '#maxlength' => 256,
    '#description' => t('Specify an alternative path by which this data can be accessed. For example, type "about" when writing an about page. Use a relative path and do not add a trailing slash or the URL alias will not work.') . ' ' . t('Leave it empty to delete URL aliases pointing to the given system path.'),
    '#field_prefix' => url('', array(
      'absolute' => TRUE,
    )) . (variable_get('clean_url', 0) ? '' : '?q='),
  );
  if (module_exists('locale')) {
    $form['settings']['language'] = array(
      '#type' => 'select',
      '#title' => t('Language'),
      '#default_value' => $settings['language'],
      '#options' => array(
        '' => '',
      ) + locale_language_list(),
      '#description' => t('Optionally make the path alias language specific.'),
    );
  }
  $form['settings']['replace'] = array(
    '#type' => 'textfield',
    '#title' => t('Replace non ascii characters with'),
    '#default_value' => $settings['replace'],
    '#maxlength' => 5,
    '#size' => 5,
    '#description' => t('Leave this textfield empty to disable the replacement of non ascii characters.'),
  );
}