You are here

public function sweaver_plugin_advanced::sweaver_form in Sweaver 7

Frontend form.

Overrides sweaver_plugin::sweaver_form

File

plugins/sweaver_plugin_advanced/sweaver_plugin_advanced.inc, line 12
Custom CSS plugin.

Class

sweaver_plugin_advanced
@file Custom CSS plugin.

Code

public function sweaver_form() {
  $current_style = Sweaver::get_instance()
    ->get_current_style();
  $form = array();
  $attributes = array();
  $form['#editor_containers'] = array();
  $form['#editor_containers']['one']['title'] = t('Watchdog');
  $form['#editor_containers']['one']['content'][] = array(
    '#markup' => '<div id="watchdog">',
  );
  $form['#editor_containers']['one']['content'][] = array(
    '#theme' => 'table',
    '#rows' => array(
      array(
        array(
          'data' => t('List of all changes made in the Style tab'),
        ),
        array(
          'data' => '<span class="title delete" onclick="Drupal.Sweaver.deleteAllProperties(); Drupal.Sweaver.writeModifications();">Delete All</span><span class="title hide" onclick="Drupal.Sweaver.cssHider(true);">Hide All</span><span class="title show" onclick="Drupal.Sweaver.cssHider(false);">Show All</span>',
          'class' => array(
            'operations',
          ),
        ),
      ),
    ),
    '#attributes' => array(
      'class' => array(
        'header',
      ),
    ),
  );
  $form['#editor_containers']['one']['content'][] = array(
    '#markup' => '<div id="scrollable_area"></div>',
  );
  $form['#editor_containers']['one']['content'][] = array(
    '#markup' => '</div>',
  );
  $form['#editor_containers']['two']['title'] = t('Custom css');
  $form['#editor_containers']['two']['content']['sweaver_plugin_custom_css'] = 'sweaver_plugin_custom_css';
  $form['sweaver_plugin_custom_css'] = array(
    '#type' => 'textarea',
    '#rows' => 10,
    '#cols' => 80,
    '#resizable' => FALSE,
    '#wysiwyg' => FALSE,
    '#attributes' => array(
      'class' => array(
        'customcss_textarea',
      ),
    ),
    '#default_value' => isset($current_style->customcss) ? $current_style->customcss : '',
    '#prefix' => '<div class="form-floater">',
  );
  $form['#editor_containers']['two']['content']['sweaver_plugin_custom_css_button'] = 'sweaver_plugin_custom_css_button';
  $form['sweaver_plugin_custom_css_button'] = array(
    '#type' => 'button',
    '#value' => t('Apply'),
    '#suffix' => '</div>',
  );
  $form['#editor_containers']['three']['title'] = t('Context');
  $form['#editor_containers']['three']['class'][] = 'context-container';
  $form['#editor_containers']['three']['content'][] = array(
    '#markup' => t('Use the current style on'),
  ) . ' : ';
  $options = array(
    0 => t('All pages except those listed'),
    1 => t('Only the listed pages'),
  );
  $form['#editor_containers']['three']['content']['context_visibility'] = 'context_visibility';
  $form['context_visibility'] = array(
    '#type' => 'radios',
    '#default_value' => isset($current_style->visibility) ? $current_style->visibility : 0,
    '#options' => $options,
  );
  $form['#editor_containers']['three']['content']['context_pages'] = 'context_pages';
  $form['context_pages'] = array(
    '#type' => 'textarea',
    '#rows' => 5,
    '#cols' => 80,
    '#title' => '<span class="element-invisible">' . t('Pages') . '</span>',
    '#default_value' => isset($current_style->pages) ? $current_style->pages : '',
    '#rows' => 2,
  );
  return $form;
}