You are here

public function stylizer_ui::get_wizard_info in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 stylizer/plugins/export_ui/stylizer_ui.class.php \stylizer_ui::get_wizard_info()

Get the form info for the wizard.

This gets the form info out of the plugin, then adds defaults based on how we want edit forms to work.

Overriding this can allow child UIs to tweak this info for specialized wizards.

Parameters

array $form_state: The already created form state.

Overrides ctools_export_ui::get_wizard_info

File

stylizer/plugins/export_ui/stylizer_ui.class.php, line 189

Class

stylizer_ui
UI class for Stylizer.

Code

public function get_wizard_info(&$form_state) {
  $form_info = parent::get_wizard_info($form_state);
  ctools_include('stylizer');

  // For add forms, we have temporarily set the 'form type' to include
  // the style type so the default wizard_info can find the path. If
  // we did that, we have to put it back.
  if (!empty($form_state['type'])) {
    $form_state['form type'] = 'add';
    $form_info['show back'] = TRUE;
  }

  // Ensure these do not get out of sync.
  $form_state['item']->settings['name'] = $form_state['item']->name;
  $form_state['settings'] = $form_state['item']->settings;

  // Figure out the base style plugin in use and make sure that is available.
  $plugin = NULL;
  if (!empty($form_state['item']->settings['style_base'])) {
    $plugin = ctools_get_style_base($form_state['item']->settings['style_base']);
    ctools_stylizer_add_plugin_forms($form_info, $plugin, $form_state['op']);
  }
  else {

    // This is here so the 'finish' button does not show up, and because
    // we don't have the selected style we don't know what the next form(s)
    // will be.
    $form_info['order']['next'] = t('Configure style');
  }

  // If available, make sure these are available for the 'choose' form.
  if (!empty($form_state['item']->style_module)) {
    $form_state['module'] = $form_state['item']->style_module;
    $form_state['type'] = $form_state['item']->style_type;
  }
  $form_state['base_style_plugin'] = $plugin;
  $form_state['settings'] = $form_state['item']->settings;
  return $form_info;
}