Hi!

I'm starting with my drupal module writing, and I'm having trouble with the API documentation for the module.
(this intro is to say i'm probably doing something stupid) :-)

I've tried to put the sample code in my custom module (all the other bits of the module work)

So, the first bit is:

$['mywidget'] = array(
  '#page callback' => 'widgetfunc',
  '#access arguments' => array('access content'),
);

but, shouldn't this be more like

$items['mywidget'] = array(
  'page callback' => 'widgetfunc',
  'access arguments' => array('access content'),
);

At least, that's how my other hook_menu menu items are...

And then, when, after changing the menu item this way I create the widget using the proposed procedure, what I get (for example using the "iframe" type), i get a small iframe with my complete page in it...

I know i'm doing something wrong... could you please help out a noob? :)

thanks

Mario

Comments

vermario’s picture

no one? :-)

jhedstrom’s picture

If you don't want the rest of the page, you need to print and exit in your page callback. Something like this:

  function widgetfunc() {
  $title = 'example widget';
  $content = 'widget body';
  print web_widgets_render_widget('inline', $content, $title);
  exit;
}
Will White’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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