function panels_common_edit_requiredcontext_form in Panels 5.2
Same name and namespace in other branches
- 6.2 includes/common-context.inc \panels_common_edit_requiredcontext_form()
Form (for ajax use) to add a context
File
- includes/
common.inc, line 1156 - Functions used by more than one panels client module.
Code
function panels_common_edit_requiredcontext_form($object, $context, $position, $contexts) {
$ctext = $object->requiredcontexts[$position];
$form['position'] = array(
'#type' => 'hidden',
'#value' => $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' => 'value',
'#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['context_info'] = array(
'#type' => 'value',
'#value' => $context,
);
$form['end_form'] = array(
'#value' => '</div>',
);
$form['next'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}