You are here

function fivestar_get_settings in Fivestar 6.2

Get all the settings set for a specific node type.

6 calls to fivestar_get_settings()
fivestar_form in ./fivestar.module
Create the fivestar form for the current item. Note that this is not an implementation of hook_form(). We should probably change the function to reflect that.
fivestar_node_type_tag_form in includes/fivestar.admin.inc
Adds fivestar enaable and position to the node-type configuration form.
fivestar_static in ./fivestar.module
Retreive and print out a static display of stars for a piece of content.
fivestar_views_value_display_handler in ./fivestar.module
VotingAPI Views formatter for displaying static stars.
fivestar_views_value_text_handler in ./fivestar.module
VotingAPI Views formatter for displaying number of stars as text.

... See full list

File

./fivestar.module, line 1530
A simple n-star voting widget, usable in other forms.

Code

function fivestar_get_settings($node_type, $tag) {
  $suffix = fivestar_get_suffix($node_type, $tag);
  $settings = array(
    'fivestar' => variable_get('fivestar_' . $suffix, 0),
    'stars' => variable_get('fivestar_stars_' . $suffix, 5),
    'unvote_enable' => variable_get('fivestar_unvote_' . $suffix, 0),
    'feedback_enable' => variable_get('fivestar_feedback_' . $suffix, 1),
    'labels_enable' => variable_get('fivestar_labels_enable_' . $suffix, 1),
    'labels' => variable_get('fivestar_labels_' . $suffix, array()),
    'star_display' => variable_get('fivestar_style_' . $suffix, 'average'),
    'text_display' => variable_get('fivestar_text_' . $suffix, 'dual'),
    'title_display' => variable_get('fivestar_title_' . $suffix, 1),
    'position' => variable_get('fivestar_position_' . $suffix, 'below'),
    'position_teaser' => variable_get('fivestar_position_teaser_' . $suffix, 'hidden'),
  );

  // Set default labels.
  if ($settings['stars'] == 5 && empty($settings['labels'])) {
    $settings['labels'] = array(
      t('Cancel rating'),
      t('Poor'),
      t('Okay'),
      t('Good'),
      t('Great'),
      t('Awesome'),
    );
  }
  for ($n = 0; $n <= 10; $n++) {
    $settings['labels'][$n] = isset($settings['labels'][$n]) ? $settings['labels'][$n] : t('Give it @star/@count');
  }
  return $settings;
}