You are here

function sweaver_settings in Sweaver 7

Same name and namespace in other branches
  1. 6 plugins/sweaver_plugin_editor/sweaver_plugin_editor.admin.inc \sweaver_settings()

Settings form.

1 string reference to 'sweaver_settings'
sweaver_plugin_editor::sweaver_menu in plugins/sweaver_plugin_editor/sweaver_plugin_editor.inc
Menu registry.

File

plugins/sweaver_plugin_editor/sweaver_plugin_editor.admin.inc, line 11
Administrative functions for Sweaver.

Code

function sweaver_settings($form, $form_state) {
  $form = array();
  $form['sweaver_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable sweaver editor'),
    '#default_value' => variable_get('sweaver_enabled', TRUE),
    '#description' => t('Enable the editor at the bottom.'),
  );
  $form['sweaver_preview_selection'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable selection preview'),
    '#default_value' => variable_get('sweaver_preview_selection', TRUE),
    '#description' => t('Enable the preview selector so you see what you are going to change.'),
  );
  $form['sweaver_combined_selectors'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable combined selectors'),
    '#default_value' => variable_get('sweaver_combined_selectors', FALSE),
    '#description' => t('Show combined tag and id or class selectors in the selectors dropdown.'),
  );
  $form['sweaver_translate_path'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable translate oject\'s path translation'),
    '#default_value' => variable_get('sweaver_translate_path', TRUE),
    '#description' => t('Translate object path in a human-readable name'),
  );
  $skins = array();
  $ignore = array(
    '.',
    '..',
    '.svn',
    'CVS',
    '.git',
  );
  $directories = scandir(drupal_get_path('module', 'sweaver') . '/skins');
  foreach ($directories as $directory) {
    if (!in_array($directory, $ignore)) {
      $skins[$directory] = $directory;
    }
  }
  $form['sweaver_skin'] = array(
    '#type' => 'select',
    '#title' => t('Sweaver skin'),
    '#options' => $skins,
    '#default_value' => variable_get('sweaver_skin', SWEAVER_SKIN),
  );
  $form['sweaver_paths'] = array(
    '#type' => 'textarea',
    '#title' => t('Exclude paths'),
    '#default_value' => variable_get('sweaver_paths', SWEAVER_PATHS_EXCLUDE),
    '#description' => t('Exclude the editor on some pages, usually administration pages. Enter one page per line as Drupal paths. The \'*\' character is a wildcard. <front> is the front page.'),
    '#wysiwyg' => FALSE,
  );
  $form['sweaver_selectors_exclude'] = array(
    '#type' => 'textarea',
    '#title' => t('Exclude selectors'),
    '#default_value' => variable_get('sweaver_selectors_exclude', SWEAVER_SELECTORS_EXCLUDE),
    '#description' => t('Define on which items the style editor should not be applicable. Enter one selector per line.'),
    '#wysiwyg' => FALSE,
  );
  $form['sweaver_classes_exclude'] = array(
    '#type' => 'textarea',
    '#title' => t('Exclude classes'),
    '#default_value' => variable_get('sweaver_classes_exclude', SWEAVER_CLASSES_EXCLUDE),
    '#description' => t('Define which classes should never be displayed in the css path. Enter one selector per line.'),
    '#wysiwyg' => FALSE,
  );
  $form['sweaver_ctools_allowed_properties'] = array(
    '#type' => 'textarea',
    '#title' => t('Allowed Properties'),
    '#default_value' => variable_get('sweaver_ctools_allowed_properties', SWEAVER_CTOOLS_ALLOWED_PROPERTIES),
    '#description' => t('Define which properties can be used in css besides the default ones defined by CTools. That list is found in ctools_css_filter_default_allowed_properties() in ctools/includes/css.inc. Enter one selector per line.'),
    '#wysiwyg' => FALSE,
  );
  $form = system_settings_form($form);
  $form['#submit'][] = 'sweaver_settings_submit';
  return $form;
}