About Widgets

Vsite Widgets allows you to add custom blocks to a vsite and configure them site-by-site.

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_os_widgets in your module
Your module should implement hook_os_widgets which adds a block to the list of blocks avalible for an openscholar site.
/**
 * hook os_widget
 */
function mymodule_os_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