function finder_ui::edit_form in Finder 7.2
Provide the actual editing form.
Overrides ctools_export_ui::edit_form
File
- modules/
finder_ui/ plugins/ export_ui/ finder_ui.class.php, line 117 - Contains the CTools Export UI integration code.
Class
- finder_ui
- CTools Export UI class handler for Finder 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']);
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 (!empty($this->plugin['export']['admin_title'])) {
$form['info'][$export_key]['#type'] = 'machine_name';
$form['info'][$export_key]['#machine_name'] = array(
'exists' => 'ctools_export_ui_edit_name_exists',
'source' => array(
'info',
$this->plugin['export']['admin_title'],
),
);
}
if ($form_state['op'] === 'edit') {
$form['info'][$export_key]['#disabled'] = TRUE;
$form['info'][$export_key]['#value'] = $item->{$export_key};
}
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 the buttons if the wizard is not in use.
if (empty($form_state['form_info'])) {
// Add buttons.
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
// Cancel buttons.
$form['actions']['cancel'] = array(
'#type' => 'submit',
'#value' => t('Cancel'),
);
}
// Add plugin's form definitions.
if (!empty($this->plugin['form']['settings'])) {
// Pass $form by reference.
$this->plugin['form']['settings']($form, $form_state);
}
}