--- simple_review.org 2008-01-08 01:31:47.000000000 +0000 +++ simple_review.module 2008-05-19 10:38:10.537672352 +0100 @@ -12,6 +12,70 @@ */ /** + * Implementation of hook_help(). + */ +function simple_review_help($section) { + switch ($section) { + case 'admin/modules#description': + return t('This module allows users to review nodes using standard comments with an attached Fivestar widget.'); + } +} + +/** + * Implementation of hook_perm(). + */ +function simple_review_perm() { + return array('administer simple_review'); +} + +/** + * Menu callback; presents the settings form for simple_review + */ +function simple_review_menu($may_cache) { + $items = array(); + if ($may_cache) { + $items[] = array( + 'path' => 'admin/settings/simple_review', + 'title' => t('Simple Review'), + 'description' => t('Simple Review settings.'), + 'access' => user_access('administer simple_review'), + 'callback' => 'drupal_get_form', + 'callback arguments' => 'simple_review_settings', + 'type' => MENU_NORMAL_ITEM, + ); + } + return $items; +} + +function simple_review_settings() { + $form['simple_review_rating_label'] = array( + '#type' => 'textfield', + '#title' => t('Rating label'), + '#size' => 20, + '#maxlength' => 30, + '#required' => TRUE, + '#default_value' => variable_get('simple_review_rating_label', t('Your rating')), + ); + $form['simple_review_review_label'] = array( + '#type' => 'textfield', + '#title' => t('Review label'), + '#size' => 30, + '#maxlength' => 40, + '#required' => TRUE, + '#default_value' => variable_get('simple_review_review_label', t('Review this article')), + ); + $form['simple_review_attributes_label'] = array( + '#type' => 'textfield', + '#title' => t('Review description'), + '#size' => 60, + '#maxlength' => 100, + '#required' => TRUE, + '#default_value' => variable_get('simple_review_attributes_label', t('Share your thoughts and opinions and rate this article.')), + ); + return system_settings_form($form); +} + +/** * Implementation of hook_form_alter(). * * Hint: To alter or remove the default name for anonymous users in the comment @@ -34,7 +98,7 @@ } $form['rating'] = array( '#type' => 'fivestar', - '#title' => t('Your rating'), + '#title' => variable_get('simple_review_rating_label', t('Your rating')), '#default_value' => (isset($current_vote) ? $current_vote->value : 0), '#weight' => 1, ); @@ -48,8 +112,8 @@ if (isset($links['comment_add'])) { if (!simple_review_already_reviewed($node->nid)) { // Change wording - $links['comment_add']['title'] = t('Review this article'); - $links['comment_add']['attributes']['title'] = t('Share your thoughts and opinions and rate this article.'); + $links['comment_add']['title'] = variable_get('simple_review_review_label', t('Review this article')); + $links['comment_add']['attributes']['title'] = variable_get('simple_review_attributes_label', t('Share your thoughts and opinions and rate this article.')); } else { // Remove link when already reviewed