function ctools_export_ui_heartbeat_plugin::edit_form in Heartbeat 7
Provide the actual editing form.
Overrides ctools_export_ui::edit_form
File
- modules/
heartbeat_plugins/ plugins/ export_ui/ ctools_export_ui_heartbeat_plugin.class.php, line 13 - Ctools export UI for a heartbeat plugin @author stalski
Class
- ctools_export_ui_heartbeat_plugin
- @file Ctools export UI for a heartbeat plugin @author stalski
Code
function edit_form(&$form, &$form_state) {
parent::edit_form($form, $form_state);
$settings = $form_state['item']->settings;
$new = TRUE;
$form['label'] = array(
'#type' => 'textfield',
'#title' => t('Label'),
'#default_value' => isset($form_state['item']->label) ? $form_state['item']->label : array(),
'#size' => 60,
'#maxlength' => 128,
'#required' => TRUE,
'#attributes' => $new ? array() : array(
'readonly' => 'readonly',
),
);
$form['module'] = array(
'#type' => 'textfield',
'#title' => t('Module'),
'#default_value' => isset($form_state['item']->module) ? $form_state['item']->module : array(),
'#size' => 60,
'#maxlength' => 128,
'#required' => TRUE,
'#attributes' => $new ? array() : array(
'readonly' => 'readonly',
),
);
$form['settings'] = array(
'#type' => 'fieldset',
'#title' => t('Settings'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#tree' => TRUE,
'#group' => 'general-tab',
);
$plugin_name = $form_state['item']->plugin_name;
$pluginWrapper = heartbeat_plugins_get_plugin($plugin_name);
if ($pluginWrapper instanceof iHeartbeatPluginWrapper) {
$plugin = $pluginWrapper
->getPlugin();
if ($plugin) {
$plugin
->pluginUIForm($form, $form_state);
}
$new = FALSE;
}
if ($new) {
$form['settings']['attachment'] = array(
'#type' => 'checkbox',
'#title' => t('Attachment'),
'#default_value' => isset($settings['attachment']) ? $settings['attachment'] : array(),
);
}
if (!element_children($form['settings'])) {
unset($form['settings']);
}
// Clear the cache for heartbeat plugins.
cache_clear_all('heartbeat_plugins', 'cache');
}