You are here

function rules_condition_alias_exists_form in Rules 6

Related topics

File

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

Code

function rules_condition_alias_exists_form($settings, &$form) {
  $settings += array(
    'dst' => '',
    'replace' => '-',
    'language' => '',
  );
  $form['settings']['dst'] = array(
    '#type' => 'textfield',
    '#title' => t('Path alias'),
    '#default_value' => $settings['dst'],
    '#maxlength' => 256,
    '#description' => t('Specify the path alias which you want to check if it already exists.'),
    '#field_prefix' => url('', array(
      'absolute' => TRUE,
    )) . (variable_get('clean_url', 0) ? '' : '?q='),
    '#required' => TRUE,
  );
  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 check for a language specific path alias.'),
    );
  }
  $form['settings']['replace'] = array(
    '#type' => 'textfield',
    '#title' => t('Before checking, 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.'),
  );
}