I run Drupal with the error level such that strict warnings are shown. On node edit pages I receive the following error:

Strict warning: Only variables should be passed by reference in relation_select_preprocess_views_view_relation_select() (line 38 of /var/www/drupal7/sites/dev.drupal7.local/modules/relation_select/theme/theme.inc).

The following line is the problem:
$entity = reset(entity_load($entity_type, array($entity_id)));

It can be replaced by a useful method supplied by the entity module:

$entity = entity_load_single($entity_type, array($entity_id));

Comments

steveoliver’s picture

Title: Strict warning in theme.inc » Strict warning in theme.inc (utilize entity_load_single)
Status: Active » Closed (fixed)

Fixed in d3b9627, Jorrit. Thanks.

steveoliver’s picture

Status: Closed (fixed) » Fixed
8ballsteve’s picture

This also adds a dependency on the entity module - worth adding this to the .info file.

steveoliver’s picture

Status: Fixed » Active

8ballsteve: Good catch. entity_load is provided by core, while entity_load_single is supplied by the Entity module.

Jorrit: Is there a way we can achieve the same functionality without depending on the Entity module?

steveoliver’s picture

Status: Active » Needs work

This should do it:

  $entity = entity_load($entity_type, array($entity_id));
  $bundle = relation_select_entity_get_bundle($entity_type, current($entity));

Going to commit this.

steveoliver’s picture

Status: Needs work » Needs review
StatusFileSize
new735 bytes

Rather, let me know how this works for you.

Jorrit’s picture

Looks good. I thought the Relation module depended on the Entity module, but this isn't the case, sorry.

steveoliver’s picture

Title: Strict warning in theme.inc (utilize entity_load_single) » Strict warning using reset() on non-variable
Status: Needs review » Fixed

Thanks, Jorrit and 8ballsteve. Committed #6 in 3642ae5.

Status: Fixed » Closed (fixed)

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