I open this issue to report a little bug, really easy to solve
It's a common problem see this blog post for more information (in french)

Problem/Motivation

When I add a new asset type I have this Warning:

Strict warning: Only variables should be passed by reference in asset_type_form() (line 65 of /asset/includes/asset.admin.inc).

Proposed resolution

Line 57 asset.admin.inc we have this code :

  $icons_options = array('none' => t('No icon'));
  $module_icons = _assets_get_icons();
  if (!empty($module_icons)) {
    $icons_options = $icons_options + $module_icons;
  }

  $form['icons']['icon'] = array(
    '#type' => 'radios',
    '#default_value' => $asset_type->icon ? $asset_type->icon : reset(array_keys($icons_options)),
    '#options' => $icons_options,
    '#title' => t('Button icon'),
  );

Just change to this :

  $icons_options = array('none' => t('No icon'));
  $module_icons = _assets_get_icons();
  if (!empty($module_icons)) {
    $icons_options = $icons_options + $module_icons;
  }

  $icons_options = array_keys($icons_options);

  $form['icons']['icon'] = array(
    '#type' => 'radios',
    '#default_value' => $asset_type->icon ? $asset_type->icon : reset($icons_options),
    '#options' => $icons_options,
    '#title' => t('Button icon'),
  );
and hop the warning disappear :)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

agalitsyn’s picture

Status: Active » Closed (fixed)
FileSize
886 bytes

Thanks, here is a patch. Will be committed in dev soon

gurvan’s picture

Status: Closed (fixed) » Patch (to be ported)
FileSize
687 bytes

Here is the clean patch, only for the asset module and not for the entire Drupal docroot (see http://drupal.org/project/asset/git-instructions fore more information about patches)

agalitsyn’s picture

Status: Patch (to be ported) » Closed (fixed)

Thanks

agalitsyn’s picture

Issue summary: View changes

remove todo

r2coder’s picture

Thanks mucho for this!