function _yashare_widget_view in Yandex.Share 7.2
Helper function to return Yandex.Share widget for the entity.
2 calls to _yashare_widget_view()
- yashare_entity_view in ./
yashare.module - Implements hook_entity_view().
- yashare_handler_field_yashare::render in views/
yashare_handler_field_yashare.inc - Render the field.
File
- ./
yashare.module, line 154
Code
function _yashare_widget_view($entity, $entity_type) {
$widget = array(
'#type' => 'yashare_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['#link'] = url($uri['path'], $uri['options']);
}
}
return $widget;
}