function heartbeat_messages_export in Heartbeat 6.3
Same name and namespace in other branches
- 6.4 heartbeat.admin.inc \heartbeat_messages_export()
Function to export messages to use as default
1 string reference to 'heartbeat_messages_export'
- heartbeat_menu in ./
heartbeat.module - Implementation of hook_menu().
File
- ./
heartbeat.admin.inc, line 453
Code
function heartbeat_messages_export($form_state = array()) {
$form = array();
$messages = heartbeat_messages('all', true, true);
if (count($messages) == 0) {
return t('There are not heartbeat messages to export.');
}
if (!isset($form_state['export'])) {
$form['messages'] = array(
'#tree' => TRUE,
);
foreach ($messages as $message) {
$form['messages']['m_' . $message->hid] = array(
'#type' => 'checkbox',
'#title' => $message->description,
'#default_value' => 1,
'#description' => $message->message,
);
}
$form['button'] = array(
'#type' => 'submit',
'#weight' => 10,
'#value' => t('Export'),
);
}
else {
//show a textarea containg the exported configs
$form['result'] = array(
'#type' => 'textarea',
'#title' => 'Exported heartbeat messages',
'#description' => 'Copy this data and paste them in <strong>hook_heartbeat_message_info</strong>.',
'#rows' => 15,
'#attributes' => array(
'readonly' => 'readonly',
),
'#default_value' => var_export(heartbeat_messages_export_messages($form_state['export']), 1),
);
}
return $form;
}