You are here

function ctools_stylizer_add_plugin_forms in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 includes/stylizer.inc \ctools_stylizer_add_plugin_forms()

Add wizard forms specific to a style base plugin.

The plugin can store forms either as a simple 'edit form' => 'form callback' or if it needs the more complicated wizard functionality, it can set 'forms' and 'order' with values suitable for the wizard $form_info array.

Parameters

&$form_info: The form info to modify.

$plugin: The plugin to use.

$op: Either 'add' or 'edit' so we can get the right forms.

2 calls to ctools_stylizer_add_plugin_forms()
ctools_stylizer_edit_style in includes/stylizer.inc
Add a new style of the specified type.
stylizer_ui::get_wizard_info in stylizer/plugins/export_ui/stylizer_ui.class.php
Get the form info for the wizard.

File

includes/stylizer.inc, line 820
Create customized CSS and images from palettes created by user input.

Code

function ctools_stylizer_add_plugin_forms(&$form_info, $plugin, $op) {
  if (empty($plugin['forms'])) {
    if ($op == 'add' && isset($plugin['add form'])) {
      $id = $plugin['add form'];
    }
    elseif (isset($plugin['edit form'])) {
      $id = $plugin['edit form'];
    }
    else {
      $id = 'ctools_stylizer_edit_style_form_default';
    }
    $form_info['forms']['settings'] = array(
      'form id' => $id,
    );
    $form_info['order']['settings'] = t('Settings');
  }
  else {
    $form_info['forms'] += $plugin['forms'];
    $form_info['order'] += $plugin['order'];
  }
}