Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As a site admin in the View UI, if I add a field to the view that is a fivestar field, I get the following AJAX error:
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: http://example.com/admin/structure/views/ajax/add-item/news_latest/page/field
StatusText: OK
ResponseText: Fatal error: Unsupported operand types in /var/www/sites/all/modules/fivestar/includes/fivestar.field.inc on line 353
Call Stack:
3.4332 780280 1. {main}() /var/www/index.php:0
7.0341 14384288 2. menu_execute_active_handler(???, ???) /var/www/index.php:23
7.0412 14477400 3. call_user_func_array(???, ???) /var/www/includes/menu.inc:503
7.0412 14478400 4. views_ui_ajax_form(???, ???, ???, ???, ???) /var/www/includes/menu.inc:503
7.7039 16961248 5. views_ajax_form_wrapper(???, ???) /var/www/sites/all/modules/views/includes/admin.inc:2837
7.7039 16962552 6. drupal_build_form(???, ???) /var/www/sites/all/modules/views/includes/ajax.inc:218
7.7039 16966064 7. drupal_retrieve_form(???, ???) /var/www/includes/form.inc:317
7.7041 16967736 8. call_user_func_array(???, ???) /var/www/includes/form.inc:773
7.7041 16968352 9. views_ui_config_item_form(???, ???) /var/www/includes/form.inc:773
7.7537 17500096 10. views_handler_field_field->options_form(???, ???) /var/www/sites/all/modules/views/includes/admin.inc:4106
7.7683 17659840 11. fivestar_field_formatter_settings_form(???, ???, ???, ???, ???) /var/www/sites/all/modules/views/modules/field/views_handler_field_field.inc:397
XDEBUGGING the code prior to line 353 of the fivestar.field.inc:
<?php
if ($instance['widget']['type'] == 'exposed') { // line 349
$entity_info = entity_get_info($instance['entity_type']); // <-- this returns NULL
// Include "Default" in the list of view modes to match the ones displayed
// to the user; see field_ui_menu().
$view_modes = array('default' => array('label' => t('Default'))) + $entity_info['view modes']; // Line 353, fails because $entity_info is NULL
$bundles = field_info_bundles($instance['entity_type']);
$element['expose'] = array(
'#type' => 'checkbox',
'#title' => t('Expose this Fivestar field for voting in the @display display on the @type type.', array('@display' => $view_modes[$view_mode]['label'], '@type' => $bundles[$instance['bundle']]['label'])),
'#default_value' => $settings['expose'],
'#return_value' => 1
);
}
?>
Comments
Comment #1
jghyde CreditAttribution: jghyde commentedI am not sure what the func entity_get_info is supposed to provide. But ignoring it, and only adding the defaults, the widget seems to act fine. So, this may not be the final solution, but it gets me into the ballpark to complete my project:
Comment #2
swfindlay CreditAttribution: swfindlay commentedI'm having the same problem but neither of these patches work for me. The error message I get logged is classified under "Theme" and the content is: "MESSAGE Theme key "fivestar_widget" not found."
The implication (I think this is related) is that I get:
"Undefined property: stdClass::$subject in include()" and
"Trying to get property of non-object in block_block_view()"
in the blocks which use Fivestar. This may be because there is some of the widget still sitting in the database somewhere(?). But I'm not sure.
Can anyone help please?
Thanks
Comment #3
bensnyder CreditAttribution: bensnyder commented.........uuuuuurg.
Anyone have an older dev they can post?
Comment #4
ericduran CreditAttribution: ericduran commented@swfindlay please try to keep the comments related to the issues. Sidetracking the issue isn't going to help anyone. Now regarding you error message please see #1268356: Theme key "fivestar_widget" not found. issue which I opened and fixed already.
@jghyde can you explain more regarding your views? I'm not really sure why entity_get_info is returning null, but I'm guessing the the fields instance settings might be missing. Maybe going in the node field settings and re-saving the field should fix it. Usually this happens when the field isn't completely saved with all the expected settings. Also please see issue #1224700: Remove custom views formatters regarding the issues with views.
Comment #5
ericduran CreditAttribution: ericduran commentedMarking as dupe of #1224700: Remove custom views formatters
Comment #6
Canadaka CreditAttribution: Canadaka commentedI just started having this problem as well after updating to the newest fivestar dev.
Comment #7
ericduran CreditAttribution: ericduran commented@Canadaka, Please see my previous comments.
Comment #8
ericduran CreditAttribution: ericduran commentedSorry for my stupidity :)
Comment #9
ericduran CreditAttribution: ericduran commented@jghyde, Thanks for tracking it down. The entity info is honestly not needed and was there to help make the certain text more clearer to the user.
That being said this is now actually/properly fixed. At least to the best of my knowledge.
Please wait up to 12 hours for this commit to be packaged with the available .zip or tar files.
Thanks again.
Please see commit for more details : http://drupal.org/commitlog/commit/2490/b127837bcdb95e7db372bba9405eeff1...
Comment #11
joachim CreditAttribution: joachim commentedWhat does this mean:
"This is not saved to used here and is honestly not need it. "
Also, a t() replacement for the entity type was left behind -- see #1814070: mysterious text "Expose this Fivestar field for voting on the @type type. " in widget options.
Furthermore, code comments should not document code history:
> Removed entity_get_info here and simplified the text.