'title' $setting in fivestar_form() uses broken shorthand PHP syntax

   $settings = array(
     'stars' => variable_get('fivestar_stars_'. $node->type, 5),
     'content_type' => $content_type,
     'content_id' => $content_id,
     'autosubmit' => TRUE,
-    'title' => variable_get('fivestar_title_'. $node->type, 1) ? NULL : FALSE,
+    'title' => variable_get('fivestar_title_'. $node->type, FALSE),
     'labels_enable' => variable_get('fivestar_labels_enable_'. $node->type, 1),
     'labels' => variable_get('fivestar_labels_'. $node->type, array()),
   );

The original line would never equate to anything better than NULL or FALSE variable_get('fivestar_title_'. $node->type, 1) ? NULL : FALSE it should just be


variable_get('fivestar_title_'. $node->type, FALSE);

CommentFileSizeAuthor
fivestar-title-settings.patch653 bytesdgtlmoon

Comments

dgtlmoon’s picture

Status: Active » Needs review
quicksketch’s picture

Status: Needs review » Closed (works as designed)

This is intentional. fivestar_custom_form() takes the $title['setting'] and processes it as noted in the comments:

  // Set an over-ridding title if passed in.
  // An empty title won't change the default, a string will set a new title,
  // and title === FALSE will unset the title entirely.
  if (isset($settings['title'])) {
    if ($settings['title'] !== FALSE) {
      $form['vote']['#title'] = $settings['title'];
    }
    else {
      unset($form['vote']['#title']);
      unset($form['average']['#title']);
    }
  }

This is setting up for possibly over-ridding the title in the Fivestar UI but has not yet been implemented.