Adding New Widgets

Create a widget

Create a block
Create a block with hook_block or via views or boxes, see drupal for how to create blocks.
Implement hook_vsite_widgets in your module
Your module should implement hook_vsite_widgets which adds a block to the list of blocks avalible for an openscholar site.

/**
 * hook vsite_widgets
 */
function mymodule_vsite_widgets(){
  $items = array();
  $items['mymodule-block5'] = array(
        'module' => 'mymodule',
        'delta' => 'block5',
        'weight' => -21,
        'region' => false,
        'label' => 'Latest Things',
        'tags' => array('social'),
      );
  return $items;
}

Where the key if the array is [module '-' delta] see above.

  • module - The module that implements hook block
  • delta - the delta of the block (passed to hook block)
  • weight - Default weight in the region
  • region - The default region the widget should be in or false if you want the widget to be avalible to all users but not in a region by default.
  • label - The Label that shows in CP Appearance
  • tags - An array of tags that this widget belongs to (optional)
  • block_config_path - Advanced A ctools popup compatible path that can be used to configure the settings for this widget. (optional)
  • icon_path - Path to an icon that represents this widget

Additionally cache parameters can be added to this array.