You are here

function skinr_ui_add in Skinr 7.2

Form builder for the add a Skinr configuration form.

1 string reference to 'skinr_ui_add'
skinr_ui_menu in ./skinr_ui.module
Implements hook_menu().

File

./skinr_ui.admin.inc, line 1132
Admin page callbacks for the Skinr UI module.

Code

function skinr_ui_add($form, &$form_state) {

  /*
  $themes = list_themes();
  ksort($themes);

  $theme_options = array();
  foreach ($themes as $theme) {
    if (!$theme->status) {
      continue;
    }
    $theme_options[$theme->name] = $theme->info['name'];
  }
  $form['theme'] = array(
    '#type' => 'select',
    '#title' => t('Theme'),
    '#options' => $theme_options,
    '#default_value' => skinr_current_theme(),
    '#required' => TRUE,
  );
  */
  $config = skinr_get_config_info();
  $modules = system_rebuild_module_data();
  $type_options = array();
  foreach ($config as $module) {
    $name = $module;
    if (isset($modules[$module])) {
      $name = $modules[$module]->info['name'];
    }
    $type_options[$module] = $name;
  }
  $form['type'] = array(
    '#type' => 'select',
    '#title' => t('Type'),
    '#options' => $type_options,
    '#required' => TRUE,
  );
  $element_options = skinr_ui_element_options();
  $form['element'] = array(
    '#type' => 'select',
    '#title' => t('Element'),
    '#options' => $element_options,
    '#required' => TRUE,
  );
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add'),
  );
  $form['#attached']['js'][] = drupal_get_path('module', 'skinr_ui') . '/js/skinr_ui.js';

  // Add settings for the update selects behavior.
  $form['#attached']['js'][] = array(
    'type' => 'setting',
    'data' => array(
      'elementOptions' => skinr_ui_element_options(),
    ),
  );
  return $form;
}