You are here

function _share42_widget_view in Share42 - social sharing buttons 7.2

Helper function to return Share42 widget for the entity.

1 call to _share42_widget_view()
share42_entity_view in ./share42.module
Implements hook_entity_view().

File

./share42.module, line 156
Main file for the Share42 module.

Code

function _share42_widget_view($entity, $entity_type) {
  $widget = array(
    '#type' => 'share42_widget',
  );
  if ($label = entity_label($entity_type, $entity)) {
    $widget['#title'] = $label;
  }
  if ($uri = entity_uri($entity_type, $entity)) {
    if (isset($uri['path'])) {
      $uri['options']['absolute'] = TRUE;
      $widget['#url'] = url($uri['path'], $uri['options']);
    }
  }
  return $widget;
}