diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2012-09-03 12:57:14 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2012-09-03 12:57:14 -0300 |
commit | 79cb3a8bde3a0c2699750a4cc36c3cab1ae6917a (patch) | |
tree | d84ebf82c91151eb5ce92469a5d93657daaf5d01 | |
parent | 339f9673536a3282109a3e1cf8d86cfe1ee1562c (diff) | |
download | reminder-79cb3a8bde3a0c2699750a4cc36c3cab1ae6917a.tar.gz reminder-79cb3a8bde3a0c2699750a4cc36c3cab1ae6917a.tar.bz2 |
Adding description field
-rw-r--r-- | reminder.install | 18 | ||||
-rw-r--r-- | reminder.module | 11 |
2 files changed, 22 insertions, 7 deletions
diff --git a/reminder.install b/reminder.install index a5bbbb0..395838a 100644 --- a/reminder.install +++ b/reminder.install @@ -64,6 +64,11 @@ function reminder_schema() { 'not null' => TRUE, 'default' => '0' ), + 'description' => array( + 'description' => t('Reminder description'), + 'type' => 'text', + 'length' => 5000, + ), ), 'primary key' => array('nid'), ); @@ -189,3 +194,16 @@ function reminder_update_7001(&$sandbox) { ) ); } + +/** + * Adds description field. + */ +function reminder_update_7002(&$sandbox) { + db_add_field('reminder', 'description', + array( + 'description' => t('Reminder description'), + 'type' => 'text', + 'length' => 5000, + ) + ); +} diff --git a/reminder.module b/reminder.module index cea6cd4..d96743b 100644 --- a/reminder.module +++ b/reminder.module @@ -147,14 +147,12 @@ function reminder_form(&$node) { ); } - if ($type->has_body) { - $form['body'] = array( + $form['description'] = array( '#type' => 'textarea', '#title' => t('Add some description'), - '#default_value' => isset($node->body) ? $node->body : '', + '#default_value' => isset($reminder['description']) ? $reminder['description']: '', '#rows' => 5 - ); - } + ); if ((isset($node->nid) && $node->uid == 0) || $user->uid == 0) { $form['anonym'] = array( @@ -257,7 +255,6 @@ function reminder_validate($node, $form, &$form_state) { * @todo * Refactor. * Date, remind and subscribe widgets. - * Save and update body/description. */ function reminder_node_submit($node, $form, &$form_state) { // No preview available. @@ -275,7 +272,6 @@ function reminder_node_submit($node, $form, &$form_state) { } $node->title = $form_state['values']['title']; - $node->body = $form_state['values']['body']; if ($node->nid == NULL) { global $user; @@ -298,6 +294,7 @@ function reminder_node_submit($node, $form, &$form_state) { 'admin_url' => $admin_url, 'anonym_name' => $anonym_name, 'anonym_email' => $anonym_email, + 'description' => $form_state['values']['description'], ); $query = db_insert('reminder')->fields($values); |