When I try to display a video, I get the following error message:

Notice: Undefined variable: value in brightcove_field_get_value() (line 1649 of /Users/thomas/Sites/gilt/cms_about/docroot/sites/all/modules/contrib/brightcove/brightcove_field/brightcove_field.module).
Notice: Trying to get property of non-object in theme_brightcove_field_embed() (line 114 of /Users/thomas/Sites/gilt/cms_about/docroot/sites/all/modules/contrib/brightcove/brightcove_field/theme.inc).
Notice: Trying to get property of non-object in theme_brightcove_field_embed() (line 118 of /Users/thomas/Sites/gilt/cms_about/docroot/sites/all/modules/contrib/brightcove/brightcove_field/theme.inc).

Digging into the code, I can see that the brightcove_field_get_value() function looks pretty half-baked. In fact, I can't even gather what the function was supposed to accomplish:

function brightcove_field_get_value($instance, $stored) {
  if ($stored) {
    return $stored;
  }

  if (!empty($instance['settings'][$value])) {
    $instance['settings'][$value];
  }

  return NULL;
}

Without this function, players won't load and therefore render. Any idea what this function was originally supposed to do?

Comments

chromix’s picture

When I change the brightcove_field_get_value() function like this, everything magically works:

function brightcove_field_get_value($instance, $stored) {
  if ($stored) {
    return $stored;
  }

  if (!empty($instance['settings']['brightcove_player'])) {
    return $instance['settings']['brightcove_player'];
  }

  return NULL;
}

Hopefully someone can commit a fix to this soon?

tamasd’s picture

Status: Active » Fixed

Fixed in bc9776c67057697bd9886f3eabcbaf1482b74b2a. Thanks for the solution. This function was refactored recently, and I incidentally forget to properly rewrite it. A new release will be out in a few minutes.

deciphered’s picture

Status: Fixed » Active

I checked out the latest version from GIT and this issues still appears to exist.

tamasd’s picture

Version: 7.x-3.0 » 7.x-3.1
Status: Active » Postponed (maintainer needs more info)

This works me with the 7.x-3.1 version. Can you verify?

chromix’s picture

This worked for me as well when I checked out the code, although I'm not using the 3 branch actively.

murrayw’s picture

I think that line 1650 in brightcove_field.module is missing a 'return' statement.

tamasd’s picture

Status: Postponed (maintainer needs more info) » Needs review

Thanks for noticing. The fix has been pushed to the 7.x-3.x branch.

tamasd’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

fixing code formatting