You are here

function _ctools_content_create_form_info in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 includes/content.inc \_ctools_content_create_form_info()
1 call to _ctools_content_create_form_info()
ctools_content_form in includes/content.inc
Get the config form.

File

includes/content.inc, line 638
Contains the tools to handle pluggable content that can be used by other applications such as Panels or Dashboard.

Code

function _ctools_content_create_form_info(&$form_info, $info, $plugin, $subtype, $op) {
  if (is_string($info)) {
    if (empty($subtype['title'])) {
      $title = t('Configure');
    }
    elseif ($op == 'add') {
      $title = t('Configure new !subtype_title', array(
        '!subtype_title' => $subtype['title'],
      ));
    }
    else {
      $title = t('Configure !subtype_title', array(
        '!subtype_title' => $subtype['title'],
      ));
    }
    $form_info['order'] = array(
      'form' => $title,
    );
    $form_info['forms'] = array(
      'form' => array(
        'title' => $title,
        'form id' => $info,
        'wrapper' => 'ctools_content_configure_form_defaults',
      ),
    );
  }
  elseif (is_array($info)) {
    $form_info['order'] = array();
    $form_info['forms'] = array();
    $count = 0;
    $base = 'step';
    $wrapper = NULL;
    foreach ($info as $form_id => $title) {

      // @todo -- docs say %title can be used to sub for the admin title.
      $step = $base . ++$count;
      if (empty($wrapper)) {
        $wrapper = $step;
      }
      if (is_array($title)) {
        if (!empty($title['default'])) {
          $wrapper = $step;
        }
        $title = $title['title'];
      }
      $form_info['order'][$step] = $title;
      $form_info['forms'][$step] = array(
        'title' => $title,
        'form id' => $form_id,
      );
    }
    if ($wrapper) {
      $form_info['forms'][$wrapper]['wrapper'] = 'ctools_content_configure_form_defaults';
    }
  }
}