function ctools_export_ui::edit_form in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 plugins/export_ui/ctools_export_ui.class.php \ctools_export_ui::edit_form()
Provide the actual editing form.
1 call to ctools_export_ui::edit_form()
- ctools_custom_content_ui::edit_form in ctools_custom_content/
plugins/ export_ui/ ctools_custom_content_ui.class.php - Provide the actual editing form.
1 method overrides ctools_export_ui::edit_form()
- ctools_custom_content_ui::edit_form in ctools_custom_content/
plugins/ export_ui/ ctools_custom_content_ui.class.php - Provide the actual editing form.
File
- plugins/
export_ui/ ctools_export_ui.class.php, line 996
Class
- ctools_export_ui
- Base class for export UI.
Code
function edit_form(&$form, &$form_state) {
$export_key = $this->plugin['export']['key'];
$item = $form_state['item'];
$schema = ctools_export_get_schema($this->plugin['schema']);
// TODO: Drupal 7 has a nifty method of auto guessing names from
// titles that is standard. We should integrate that here as a
// nice standard.
// Guess at a couple of our standard fields.
if (!empty($this->plugin['export']['admin_title'])) {
$form['info'][$this->plugin['export']['admin_title']] = array(
'#type' => 'textfield',
'#title' => t('Administrative title'),
'#description' => t('This will appear in the administrative interface to easily identify it.'),
'#default_value' => $item->{$this->plugin['export']['admin_title']},
);
}
$form['info'][$export_key] = array(
'#title' => t($schema['export']['key name']),
'#type' => 'textfield',
'#default_value' => $item->{$export_key},
'#description' => t('The unique ID for this @export.', array(
'@export' => $this->plugin['title singular'],
)),
'#required' => TRUE,
'#maxlength' => 255,
);
if ($form_state['op'] === 'edit') {
$form['info'][$export_key]['#disabled'] = TRUE;
$form['info'][$export_key]['#value'] = $item->{$export_key};
}
else {
$form['info'][$export_key]['#element_validate'] = array(
'ctools_export_ui_edit_name_validate',
);
}
if (!empty($this->plugin['export']['admin_description'])) {
$form['info'][$this->plugin['export']['admin_description']] = array(
'#type' => 'textarea',
'#title' => t('Administrative description'),
'#default_value' => $item->{$this->plugin['export']['admin_description']},
);
}
// Add plugin's form definitions.
if (!empty($this->plugin['form']['settings'])) {
// Pass $form by reference.
$this->plugin['form']['settings']($form, $form_state);
}
// Add the buttons if the wizard is not in use.
if (empty($form_state['form_info'])) {
// Make sure that whatever happens, the buttons go to the bottom.
$form['buttons']['#weight'] = 100;
// Add buttons.
$form['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
$form['buttons']['delete'] = array(
'#type' => 'submit',
'#value' => $item->export_type & EXPORT_IN_CODE ? t('Revert') : t('Delete'),
'#access' => $form_state['op'] === 'edit' && $item->export_type & EXPORT_IN_DATABASE,
'#submit' => array(
'ctools_export_ui_edit_item_form_delete',
),
);
}
}