You are here

function ctools_edit_requiredcontext_form in Chaos Tool Suite (ctools) 6

Form (for ajax use) to add a context

1 string reference to 'ctools_edit_requiredcontext_form'
ctools_context_info in includes/context-admin.inc
Provide a list of the ways contexts can be embedded.

File

includes/context-admin.inc, line 670
includes/common-context.inc Provide API for adding contexts for modules that embed displays.

Code

function ctools_edit_requiredcontext_form(&$form_state) {
  $object = $form_state['object'];
  $context = $form_state['info'];
  $position = $form_state['position'];
  $contexts = $form_state['contexts'];
  $ctext = $object->requiredcontexts[$position];
  $form['start_form'] = array(
    '#value' => '<div class="modal-form clear-block">',
  );
  $form['description'] = array(
    '#prefix' => '<div class="description">',
    '#suffix' => '</div>',
    '#value' => check_plain($context['description']),
  );

  // Basic context values
  $form['requiredcontext']['#tree'] = TRUE;
  $form['requiredcontext']['name'] = array(
    '#type' => 'hidden',
    '#value' => $context['name'],
  );
  $form['requiredcontext']['id'] = array(
    '#type' => 'hidden',
    '#value' => $ctext['id'],
  );
  $form['requiredcontext']['identifier'] = array(
    '#type' => 'textfield',
    '#title' => t('Identifier'),
    '#description' => t('Enter a name to identify this !type on administrative screens.', array(
      '!type' => t('required context'),
    )),
    '#default_value' => $ctext['identifier'],
  );
  $form['requiredcontext']['keyword'] = array(
    '#type' => 'textfield',
    '#title' => t('Keyword'),
    '#description' => t('Enter a keyword to use for substitution in titles.'),
    '#default_value' => $ctext['keyword'],
  );
  $form['end_form'] = array(
    '#value' => '</div>',
  );
  $form['next'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}