Download & Extend

Doesn't create a view source

Project:Embed widgets
Version:6.x-1.0-rc1
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active

Issue Summary

When you try to create a view source it returns with a warning error about a $source['settings'] that is not an array. The problem is Php try to make a merge with a unitialized key of the array, simply add a $source['settings'] = array(); when initializing all the vars before save the widget source.

Works for me...

  // Submitted from source edit page.
  $source = isset($form_state['values']['source']) ? $form_state['values']['source'] : array();
  $source['title'] = $form_state['values']['basic_info']['title'];
  $source['description'] = $form_state['values']['basic_info']['description'];
  $source['type'] = $form_state['values']['config']['type'];
  $source['settings'] = array();
  if ($form_state['values']['config']['type'] == 'page') {
    $source['settings']['path'] = $form_state['values']['config']['new_source']['page'];
  }
  else if ($form_state['values']['config']['type'] == 'block') {
    list($module, $delta) = split("_#_", $form_state['values']['config']['new_source']['block']);
    $source['settings']['module'] = $module;
    $source['settings']['delta'] = $delta;
  }
  else if ($form_state['values']['config']['type'] == 'view') {
    $source['settings'] = array_merge($source['settings'], $form_state['values']['config']['new_source']['view']);
  }

Comments

#1

Here I created a patch file which typecast $source['settings'] to array.

AttachmentSize
732248_embed_widgets_view_source.patch 603 bytes