You are here

function _themekey_paths_form in ThemeKey 6

Function _themekey_paths_form().

1 string reference to '_themekey_paths_form'
themekey_menu in ./themekey.module
Implementation of hook_menu().

File

./themekey_admin.inc, line 10

Code

function _themekey_paths_form() {
  $form['paths'] = array(
    '#type' => 'fieldset',
    '#title' => t('Paths'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#description' => t('Here you can map themes to Drupal paths or path aliases. To add a new map entry to the table,
                         enter the path into the \'Path\' field and select a theme from the \'Theme\' dropdown. For example:
                         Path = \'node/add\' and Theme = \'Bluemarine\' switches the theme of the \'Create content\' page to
                         Bluemarine. You may also use wildcard characters in the path and/or specify \'Conditions\' to match.<br />
                         Wildcard characters are \'#\' for numeric parts and \'%\' for all characters. To match conditions
                         against a certain part, use an identifier with the wildcard. For example: Path =
                         \'comment/reply/#xyz\' matches all paths with \'comment/reply\' and a numeric third argument.
                         You can then specify conditions for every wildcard argument using the following syntax:
                         \'id=value;id2=value2;...\', e.g. \'xyz=123\'. Supported operators are \'=\' (equal), \'!\' (not equal),
                         \'<\' (smaller) and \'>\' (greater).'),
  );
  $form['paths']['table'] = array(
    '#theme' => 'themekey_table',
    '#header' => array(
      t('Path'),
      t('Conditions'),
      t('Theme'),
    ),
    '#tree' => TRUE,
  );
  $themes = _themekey_theme_options();
  $paths = _themekey_load_paths(THEMEKEY_PAGER_LENGTH);
  foreach ($paths as $path) {
    $form['paths']['table'][$path['id']]['path'] = array(
      '#type' => 'textfield',
      '#default_value' => $path['path'],
      '#size' => 40,
      '#maxlength' => 255,
    );
    $form['paths']['table'][$path['id']]['conditions'] = array(
      '#type' => 'textfield',
      '#default_value' => $path['conditions'],
      '#size' => 20,
      '#maxlength' => 255,
    );
    $form['paths']['table'][$path['id']]['theme'] = array(
      '#type' => 'select',
      '#default_value' => $path['theme'],
      '#options' => $themes,
    );
  }
  if (count($paths)) {
    $form['paths']['pager'] = array(
      '#value' => theme('pager', array(), THEMEKEY_PAGER_LENGTH),
    );
  }
  $form['paths']['addtable'] = array(
    '#theme' => 'themekey_table',
    '#header' => array(
      t('Path'),
      t('Conditions'),
      t('Theme'),
    ),
    '#tree' => TRUE,
  );
  $form['paths']['addtable']['add']['path'] = array(
    '#type' => 'textfield',
    '#default_value' => '',
    '#size' => 40,
    '#maxlength' => 255,
  );
  $form['paths']['addtable']['add']['conditions'] = array(
    '#type' => 'textfield',
    '#default_value' => '',
    '#size' => 20,
    '#maxlength' => 255,
  );
  $form['paths']['addtable']['add']['theme'] = array(
    '#type' => 'select',
    '#default_value' => 'default',
    '#options' => $themes,
  );
  return _themekey_admin_form($form, '_themekey_paths');
}