You are here

function skinr_ui_edit in Skinr 6.2

Same name and namespace in other branches
  1. 7.2 skinr_ui.edit.inc \skinr_ui_edit()

Menu callback; prepares some variables and displays a Skinr edit form.

@todo Enter description of parameters.

Parameters

$js: ...

$module: The module that we're editing settings of.

$sid: The sid of the object we're editing settings of.

$sids: ...

1 string reference to 'skinr_ui_edit'
skinr_ui_menu in ./skinr_ui.module
Implementation of hook_menu().

File

./skinr_ui.module, line 242

Code

function skinr_ui_edit($js = FALSE, $module, $sid, $sids = NULL) {
  global $gskinr;
  if ($js) {
    ctools_include('ajax');
    $form_state = array(
      'ajax' => TRUE,
      'title' => skinr_ui_edit_title($module, $sid),
      'skinr' => array(
        'module' => $module,
        'sid' => $sid,
        'sids' => $sids,
      ),
    );
    $output = dialog_form_wrapper('skinr_ui_form', $form_state);
    if (empty($output)) {
      $output[] = dialog_command_loading();
      if (isset($gskinr[$module][$sid])) {
        if (is_null($sids)) {
          $sids = $sid;
        }
        $output[] = skinr_ui_command_afterupdate($module, $sids, $gskinr[$module][$sid]['classes']['remove'], $gskinr[$module][$sid]['classes']['add'], $gskinr[$module][$sid]['css'], $gskinr[$module][$sid]['js']);
        unset($gskinr[$module][$sid]);
      }
      $output[] = dialog_command_dismiss();
    }
    else {
      foreach ($output as $i => $command) {
        if ($command['command'] == 'dialog_display') {
          $output[$i]['options']['height'] = variable_get('skinr_overlay_height', NULL);
          $output[$i]['options']['width'] = variable_get('skinr_overlay_width', 600);
          $output[$i]['options']['position'] = 'center';
          $output[$i]['options']['resizable'] = TRUE;
        }
      }
    }
    ctools_ajax_render($output);
  }
  else {
    $arguments = array(
      'skinr' => array(
        'module' => $module,
        'sid' => $sid,
        'sids' => $sids,
      ),
    );
    return drupal_get_form('skinr_ui_form', $arguments);
  }
}