when I run

module_invoke('boxes', 'block', 'view', $delta);

to display a box in an og space node I get this error

Cannot use object of type boxes_simple as array in ..... \boxes\boxes.module on line 453

when I run the same code in a normal node it works and prints the box.

Comments

tobiassjosten’s picture

I'm having this same problem, with the same version. However I don't "manually" output the box but I use Context to place the block instead.

jmiccolis’s picture

Are these fresh installs or upgrades from a previous version of boxes?

abbasmousavi’s picture

I have uninstalled beta 4 then installed beta 5

abbasmousavi’s picture

it seems that this patch solves the problem


--- boxes.module	Mon Apr 26 06:45:58 2010
+++ boxes.module	Wed Apr 28 13:56:16 2010
@@ -450,7 +450,7 @@
 function boxes_boxes_view_alter(&$box, $delta) {
   if (module_exists('spaces') && $space = spaces_get_space()) {
     if ($space_box = $space->controllers->boxes->get($delta)) {
-      $box = boxes_create($space_box['plugin_key']);
+      $box = boxes_create($space_box->plugin_key);
       $box->set($space_box);
       $box->new = FALSE;
     }
--- plugins/boxes_box.inc	Wed Mar 31 02:04:31 2010
+++ plugins/boxes_box.inc	Wed Apr 28 13:54:36 2010
@@ -73,13 +73,13 @@
    */
   public function set($values) {
     foreach ($this as $key => $value) {
-      if (isset($values[$key])) {
-        $this->$key = $values[$key];
+      if (isset($values->$key)) {
+        $this->$key = $values->$key;
       }
     }
     foreach ($this->options_defaults() as $key => $value) {
-      if (isset($values[$key])) {
-        $this->options[$key] = $values[$key];
+      if (isset($values->$key)) {
+        $this->options[$key] = $values->$key;
       }
     }
     // Make sure box is present in static cache as soon as delta is set.

abbasmousavi’s picture

when I use inline editing to save a box I get following error

Fatal error  Uncaught exception 'Exception' with message 'Plugin  not found.' in boxes\plugins\boxes_box.inc:55

Stack trace:
#0 boxes\boxes.module(204): boxes_box::create(NULL)
#1 boxes\boxes.module(453): boxes_create(NULL)
...

it seems that $space->controllers->boxes->get($delta) returns null.
It can not also be saved from blocks administration page.

mrtorrent’s picture

Patch from #4 seems to work for me

mrtorrent’s picture

Scratch that, when editing a box with the patch from #4, I get:
Exception: Cannot save box without a specified delta. in sites/all/modules/boxes/plugins/boxes_box.inc on line 103

mrtorrent’s picture

A really quick albeit incomplete fix is to just cast the box object to an array:

--- a/sites/all/modules/boxes/boxes.module
+++ b/sites/all/modules/boxes/boxes.module
@@ -452,7 +452,7 @@ function boxes_context_block_info_alter(&$blocks) {
  */
 function boxes_boxes_view_alter(&$box, $delta) {
   if (module_exists('spaces') && $space = spaces_get_space()) {
-    if ($space_box = $space->controllers->boxes->get($delta)) {
+    if ($space_box = (array) $space->controllers->boxes->get($delta)) {
       $box = boxes_create($space_box['plugin_key']);
       $box->set($space_box);
       $box->new = FALSE;

Really, though, this should be fixed properly. I'm afraid I don't have any idea what's going on here, so I can't be much help finding a better solution than this.

jmiccolis’s picture

Just seeing this issue again after posting http://drupal.org/node/812252#comment-3025718

I suspect these issues are related. Tests with that patch would be appreciated.

abbasmousavi’s picture

Version: 6.x-1.0-beta5 » 6.x-1.0-beta6

the problem also exists in beta 6. with the patch in #4 I can see the box but I can not edit the box.

abbasmousavi’s picture

to :jmiccolis the patch does not solve the problem.

abbasmousavi’s picture

to: mrtorrent

casting the box object only solves the viewing problem, not editing problem. when I edit the box I get no error but the changes does not save.

tanc’s picture

Tested patch from #6 in http://drupal.org/node/812252
Initial tests seem to indicate that the problem of editing the boxes and viewing the boxes in an OG space is fixed. Note that I updated to latest betas of context, spaces and boxes, upgraded db and then applied boxes patch.

Will report back if I find any more issues.

jmiccolis’s picture

@abbasmousavi can you please test against cvs branch DRUPAL-6--1 directly, I've just committed a set of changes that should address your issue. I'll be rolling these changes into a release in the next day or so.

abbasmousavi’s picture

@jmiccolis applying patch from #6 in http://drupal.org/node/812252 to beta6 solves the problem for me. thanks.

jmiccolis’s picture

Status: Active » Fixed

Great. There will be a new release of boxes a little later today.

Status: Fixed » Closed (fixed)

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