forked from wet-boew-wem/wetkit-widgets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wetkit_widgets.plugins.inc
657 lines (608 loc) · 22.5 KB
/
wetkit_widgets.plugins.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
<?php
/**
* @file
* A specification for the custom tabbed interface entity that is part of
* WetKit Widgets.
*/
/**
* Implements hook_preprocess_panels_pane().
*/
function wetkit_widgets_preprocess_panels_pane(&$variables) {
$bundle = isset($variables['content']['#bundle']) ? $variables['content']['#bundle'] : '';
if ($bundle == 'tabbed_interface') {
$variables['theme_hook_suggestions'][] = 'panels_pane__fieldable_panels_pane__tabbed_interface';
}
}
/**
* Implements hook_field_info().
*/
function wetkit_widgets_field_info() {
return array(
'wetkit_tabbed_interface' => array(
'label' => t('Tabbed Interface'),
'description' => t("WetKit Plugin for the Web Experience Toolkit's Tabbed Interface"),
'default_widget' => 'wetkit_tabbed_interface_form',
'default_formatter' => 'wetkit_tabbed_interface_default',
'settings' => array(
'uri_scheme' => variable_get('file_default_scheme', 'public'),
'default_image' => 1,
),
'instance_settings' => array(
'file_extensions' => 'jpg jpeg gif png',
'file_directory' => 'general',
'max_filesize' => '',
'alt_field' => 0,
'title_field' => 0,
'max_resolution' => '',
'min_resolution' => '',
),
),
);
}
/**
* Implements hook_field_is_empty().
*/
function wetkit_widgets_field_is_empty($item, $field) {
if (empty($item['title']) && empty($item['link']) && empty($item['description']) && empty($item['fid'])) {
return TRUE;
}
return FALSE;
}
/**
* Implements hook_field_widget_info().
*/
function wetkit_widgets_field_widget_info() {
return array(
'wetkit_tabbed_interface_form' => array(
'label' => t('Tabbed Interface'),
'field types' => array('wetkit_tabbed_interface'),
'behaviors' => array(
'multiple values' => FIELD_BEHAVIOR_DEFAULT,
'default value' => FIELD_BEHAVIOR_DEFAULT,
),
),
);
}
/**
* Implements hook_field_settings_form().
*/
function wetkit_widgets_field_settings_form($field, $instance, $has_data) {
$form = array();
$defaults = field_info_field_settings($field['type']);
$settings = array_merge($defaults, $field['settings']);
$scheme_options = array();
foreach (file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE) as $scheme => $stream_wrapper) {
$scheme_options[$scheme] = $stream_wrapper['name'];
}
$form['uri_scheme'] = array(
'#type' => 'radios',
'#title' => t('Upload destination'),
'#options' => $scheme_options,
'#default_value' => $settings['uri_scheme'],
'#description' => t('Select where the final files should be stored. Private file storage has significantly more overhead than public files, but allows restricted access to files within this field.'),
);
// When the user sets the scheme on the UI, even for the first time, it's
// updating a field because fields are created on the "Manage fields"
// page. So image_field_update_field() can handle this change.
$form['default_image'] = array(
'#title' => t('Default image'),
'#type' => 'managed_file',
'#description' => t('If no image is uploaded, this image will be shown on display.'),
'#default_value' => $field['settings']['default_image'],
'#upload_location' => $settings['uri_scheme'] . '://default_images/',
);
return $form;
}
/**
* Implements hook_field_instance_settings_form().
*/
function wetkit_widgets_field_instance_settings_form($field, $instance) {
$form = image_field_instance_settings_form($field, $instance);
return $form;
}
/**
* Implements hook_field_formatter_info().
*/
function wetkit_widgets_field_formatter_info() {
return array(
'file_wetkit_video' => array(
'label' => t('WetKit Video'),
'description' => t('Render the file using an HTML5 video tag'),
'field types' => array('file'),
'settings' => array(
'controls' => TRUE,
'autoplay' => FALSE,
'loop' => FALSE,
'muted' => FALSE,
'size' => array(
'width' => NULL,
'height' => NULL,
),
'multiple_file_behaviour' => 'sources',
),
),
'wetkit_widgets_lightbox' => array(
'label' => t('WetKit Lightbox'),
'field types' => array('image'),
'settings' => array(
'image_style_destination' => 'large',
'image_style_source' => 'thumbnail',
'custom_class' => '',
),
),
'wetkit_widgets_share' => array(
'label' => t('WetKit Share Widget'),
'field types' => array('list_text'),
'settings' => array(
'custom_class' => '',
),
),
'wetkit_tabbed_interface_default' => array(
'label' => t('Default'),
'field types' => array('wetkit_tabbed_interface'),
'settings' => array(
'image_style' => 'panopoly_image_spotlight',
),
),
);
}
/**
* Implements hook_field_formatter_settings_summary().
*/
function wetkit_widgets_field_formatter_settings_summary($field, $instance, $view_mode) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$summary = "";
if ($display['type'] == 'wetkit_widgets_lightbox') {
// Destination image style.
$value = empty($settings['image_style_destination']) ? '<em>' . t('Empty') . '</em>' : $settings['image_style_destination'];
$value = is_array($value) ? implode(', ', array_filter($value)) : $value;
$summary .= "Destination image style: {$value}<br />";
// Source image style.
$value = empty($settings['image_style_source']) ? '<em>' . t('Empty') . '</em>' : $settings['image_style_source'];
$value = is_array($value) ? implode(', ', array_filter($value)) : $value;
$summary .= "Source image style: {$value}<br />";
// Custom Class.
$value = empty($settings['custom_class']) ? '<em>' . t('Empty') . '</em>' : $settings['custom_class'];
$value = is_array($value) ? implode(', ', array_filter($value)) : $value;
$summary .= "Custom Class: {$value}<br />";
}
elseif ($display['type'] == 'wetkit_widgets_share') {
// Custom Class.
$value = empty($settings['custom_class']) ? '<em>' . t('Empty') . '</em>' : $settings['custom_class'];
$value = is_array($value) ? implode(', ', array_filter($value)) : $value;
$summary .= "Custom Class: {$value}<br />";
}
elseif ($display['type'] === 'file_wetkit_video') {
$summary_items = array();
if (isset($settings['multiple_file_behaviour'])) {
$summary_items[] = t('Multiple files: %multiple', array('%multiple' => $settings['multiple_file_behaviour']));
}
if (isset($settings['controls'])) {
$summary_items[] = t('Controls: %controls', array('%controls' => $settings['controls'] ? 'visible' : 'hidden'));
}
if (isset($settings['autoplay'])) {
$summary_items[] = t('Autoplay: %autoplay', array('%autoplay' => $settings['autoplay'] ? t('yes') : t('no')));
}
if (isset($settings['loop'])) {
$summary_items[] = t('Loop: %loop', array('%loop' => $settings['loop'] ? t('yes') : t('no')));
}
if (isset($settings['muted'])) {
$summary_items[] = t('Muted: %muted', array('%muted' => $settings['muted'] ? t('yes') : t('no')));
}
if ($settings['size']['width'] && $settings['size']['height']) {
$summary_items[] = t('Size: %width x %height', array('%width' => $settings['size']['width'], '%height' => $settings['size']['height']));
}
$summary = implode('<br />', $summary_items);
}
elseif ($display['type'] == 'wetkit_tabbed_interface_default') {
$summary = t('Image Style: @style', array('@style' => $settings['image_style']));
}
return $summary;
}
/**
* Implements hook_field_formatter_settings_form().
*/
function wetkit_widgets_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$element = array();
if ($display['type'] == 'wetkit_widgets_lightbox') {
$element['image_style_destination'] = array(
'#weight' => '1',
'#default_value' => $settings['image_style_destination'],
'#multiple_toggle' => '1',
'#key_type_toggled' => '1',
'#options' => image_style_options(),
'#type' => 'select',
'#title' => t('Destination image style'),
);
$element['image_style_source'] = array(
'#options' => image_style_options(),
'#default_value' => $settings['image_style_source'],
'#type' => 'select',
'#weight' => '1',
'#multiple_toggle' => '1',
'#title' => t('Source image style'),
'#key_type_toggled' => '1',
);
$element['custom_class'] = array(
'#title' => t('Custom Class'),
'#default_value' => $settings['custom_class'],
'#required' => '0',
'#type' => 'textfield',
'#description' => t('Should you wish to define a custom class for this element such as a span please declare it here.'),
'#weight' => '2',
'#size' => '20',
);
}
elseif ($display['type'] == 'wetkit_widgets_share') {
$element['custom_class'] = array(
'#required' => '0',
'#default_value' => $settings['custom_class'],
'#weight' => '0',
'#description' => t('Should you wish to define a custom class for this element such as a span please declare it here.'),
'#title' => t('Custom Class'),
'#type' => 'textfield',
'#size' => '20',
);
}
elseif ($display['type'] == 'wetkit_tabbed_interface_default') {
$element['image_style'] = array(
'#title' => t('Image style'),
'#type' => 'select',
'#options' => image_style_options(),
'#default_value' => $settings['image_style'],
'#required' => TRUE,
);
}
elseif ($display['type'] == 'file_wetkit_video') {
$element['controls'] = array(
'#title' => t('Show video controls'),
'#type' => 'checkbox',
'#default_value' => isset($settings['controls']) ? $settings['controls'] : TRUE,
);
$element['autoplay'] = array(
'#title' => t('Autoplay'),
'#type' => 'checkbox',
'#default_value' => isset($settings['autoplay']) ? $settings['autoplay'] : FALSE,
);
$element['loop'] = array(
'#title' => t('Loop'),
'#type' => 'checkbox',
'#default_value' => isset($settings['loop']) ? $settings['loop'] : FALSE,
);
$element['size'] = array(
'#type' => 'item',
'#title' => t('Size'),
'#field_prefix' => '<div class="container-inline">',
'#field_suffix' => '</div>',
'#description' => t('The size expressed as WIDTHxHEIGHT (for example, 640x480). Leave blank to use the video file to determine the size of the player.'),
);
$element['size']['width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#title_display' => 'invisible',
'#default_value' => isset($settings['size']['width']) ? $settings['size']['width'] : NULL,
'#size' => 5,
'#maxlength' => 5,
'#field_suffix' => ' x ',
);
$element['size']['height'] = array(
'#type' => 'textfield',
'#title' => t('Height'),
'#title_display' => 'invisible',
'#default_value' => isset($settings['size']['height']) ? $settings['size']['height'] : NULL,
'#size' => 5,
'#maxlength' => 5,
'#field_suffix' => ' ' . t('pixels'),
);
$element['multiple_file_behaviour'] = array(
'#title' => t('Display of multiple files'),
'#type' => 'radios',
'#options' => array(
'sources' => t('Use multiple sources within a single <video> tag'),
'tags' => t('Use multiple <video> tags, each with a single source'),
),
'#default_value' => isset($settings['multiple_file_behaviour']) ? $settings['multiple_file_behaviour'] : 'sources',
);
}
return $element;
}
/**
* Implements hook_field_formatter_view().
*/
function wetkit_widgets_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array();
$settings = $display['settings'];
$formatter = $display['type'];
if ($display['type'] == 'wetkit_widgets_lightbox') {
// Build variables array for formatter.
$variables = array(
'#obj_type' => $entity_type,
'#object' => $entity,
'#field' => $field,
'#instance' => $instance,
'#langcode' => $langcode,
'#items' => $items,
'#display' => $display,
);
if (function_exists($function = "{$display['module']}_field_formatter_{$display['type']}")) {
$element[0] = array(
'#markup' => $function($variables),
);
}
}
elseif ($display['type'] == 'wetkit_widgets_share') {
// Build variables array for formatter.
$variables = array(
'#obj_type' => $entity_type,
'#object' => $entity,
'#field' => $field,
'#instance' => $instance,
'#langcode' => $langcode,
'#items' => $items,
'#display' => $display,
);
if (function_exists($function = "{$display['module']}_field_formatter_{$display['type']}")) {
$element[0] = array(
'#markup' => $function($variables),
);
}
}
elseif ($display['type'] == 'file_wetkit_video') {
$multiple_file_behaviour = isset($settings['multiple_file_behaviour']) ? $settings['multiple_file_behaviour'] : 'sources';
// Prevent 'empty' fields from causing a WSOD.
$items = array_filter($items);
// Build an array of sources for each <video> element.
$source_lists = array();
if ($multiple_file_behaviour == 'tags') {
foreach ($items as $delta => $item) {
if ($item['type'] == 'wetkit_video') {
$source_lists[] = array($item);
}
}
}
else {
foreach ($items as $delta => $item) {
if ($item['type'] == 'wetkit_video') {
$source_lists[0][] = $item;
}
}
}
// Render each source list as an <video> element.
foreach ($source_lists as $delta => $sources) {
$width = isset($settings['size']['width']) ? $settings['size']['width'] : NULL;
$height = isset($settings['size']['height']) ? $settings['size']['height'] : NULL;
$element[$delta] = array(
'#theme' => 'wetkit_widgets_file_video',
'#files' => $sources,
'#controls' => isset($settings['controls']) ? $settings['controls'] : TRUE,
'#autoplay' => isset($settings['autoplay']) ? $settings['autoplay'] : FALSE,
'#loop' => isset($settings['loop']) ? $settings['loop'] : FALSE,
'#muted' => isset($settings['muted']) ? $settings['muted'] : FALSE,
'#width' => ($width && $height) ? $width : NULL,
'#height' => ($width && $height) ? $height : NULL,
);
}
}
elseif ($display['type'] == 'wetkit_tabbed_interface_default') {
drupal_add_library('system', 'ui.tabs');
// Assemble the tabs content.
foreach ($items as $delta => $item_data) {
$element[$delta]['#markup'] = ($delta == 0) ? theme('wetkit_tab_interface_view', array(
'items' => $item_data,
'delta' => $delta,
'settings' => $settings,
)) : theme('wetkit_tab_interface_view', array(
'items' => $item_data,
'delta' => $delta,
'settings' => $settings,
));
$element[$delta]['title'] = ($delta == 0) ? $item_data['title'] : $item_data['title'];
// If panel style is applied.
$element[$delta]['tabbed_true'] = 'true';
}
}
return $element;
}
/**
* Implements hook_widget_form().
*/
function wetkit_widgets_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
if ($instance['widget']['type'] == 'wetkit_tabbed_interface_form') {
// Make it a multipart form.
$form['#attributes']['enctype'] = 'multipart/form-data';
// Define the element.
$element['title'] = array(
'#title' => 'Title',
'#type' => 'textfield',
'#default_value' => isset($items[$delta]['title']) ? $items[$delta]['title'] : NULL,
);
$element['link'] = array(
'#title' => 'Link',
'#type' => 'textfield',
'#default_value' => isset($items[$delta]['link']) ? $items[$delta]['link'] : NULL,
);
$element['fid'] = array(
'#title' => 'Image',
'#type' => 'managed_file',
'#upload_location' => file_field_widget_uri($field, $instance),
'#default_value' => isset($items[$delta]['fid']) ? $items[$delta]['fid'] : NULL,
);
$element['alt'] = array(
'#title' => 'Alt',
'#type' => 'textfield',
'#default_value' => isset($items[$delta]['alt']) ? $items[$delta]['alt'] : NULL,
);
$element['description'] = array(
'#title' => 'Description',
'#type' => 'textarea',
'#rows' => '2',
'#resizable' => FALSE,
'#default_value' => isset($items[$delta]['description']) ? $items[$delta]['description'] : NULL,
);
}
return $element;
}
/**
* Implements hook_field_presave().
*/
function wetkit_widgets_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
// We need to set presave values if fids are not set. This shouldn't effect save operations
// form API validation will prevent this from ever happening unless previewing.
if (!empty($items)) {
foreach ($items as &$item) {
if (empty($item['fid'])) {
$fid = variable_get('wetkit_widgets_default_' . $entity->bundle . '_fid', NULL);
if (!empty($fid)) {
$item['fid'] = $fid;
}
}
}
image_field_presave($entity_type, $entity, $field, $instance, $langcode, $items);
}
}
/**
* Implements hook_field_load().
*/
function wetkit_widgets_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) {
image_field_load($entity_type, $entities, $field, $instances, $langcode, $items, $age);
}
/**
* Implements hook_field_insert().
*/
function wetkit_widgets_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items) {
image_field_insert($entity_type, $entity, $field, $instance, $langcode, $items);
}
/**
* Implements hook_field_update().
*/
function wetkit_widgets_field_update($entity_type, $entity, $field, $instance, $langcode, &$items) {
// Load the original entity, if $entity->original is not already set.
// This is done as per http://drupal.org/node/985642 and can be removed when
// that patch is committed.
if (empty($entity->original)) {
$entity->original = entity_load_unchanged($entity_type, $field['id']);
}
image_field_update($entity_type, $entity, $field, $instance, $langcode, $items);
}
/**
* Implements hook_field_delete().
*/
function wetkit_widgets_field_delete($entity_type, $entity, $field, $instance, $langcode, &$items) {
image_field_delete($entity_type, $entity, $field, $instance, $langcode, $items);
}
/**
* Implements hook_field_delete_revision().
*/
function wetkit_widgets_field_delete_revision($entity_type, $entity, $field, $instance, $langcode, &$items) {
image_field_delete_revision($entity_type, $entity, $field, $instance, $langcode, $items);
}
/**
* Implements hook_field_prepare_view().
*/
function wetkit_widgets_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items) {
// If there are no files specified at all, use the default.
// TODO - make sure this works.
foreach ($entities as $id => $entity) {
if (empty($items[$id]) && $field['settings']['default_image']) {
if ($file = file_load($field['settings']['default_image'])) {
$items[$id][0] = (array) $file + array(
'is_default' => TRUE,
'alt' => '',
'title' => '',
);
}
}
}
}
/**
* Theme function for table view.
*/
function theme_wetkit_tab_interface_view($variables) {
$title = $variables['items']['title'];
$description = $variables['items']['description'];
if (module_exists('uuid')) {
$image_entity = entity_uuid_load('file', array($variables['items']['uuid']));
$image = file_load(array_pop($image_entity)->fid);
}
else {
$image = (object) $variables['items'];
}
$link = $variables['items']['link'];
$settings = $variables['settings'];
$output = '<div id="' . 'tabs1_' . $variables['delta'] . '" class="tabs-content-pad ' . '' . '">';
$output .= '<section>';
$output .= '<h4>' . l($title, $link) . '</h4>';
$output .= theme('image_style', array(
'style_name' => $settings['image_style'],
'path' => $image->uri,
'alt' => $variables['items']['alt'],
));
$output .= '<p>' . $description . '</p>';
$output .= '</section>';
$output .= '</div>';
return $output;
}
/**
* Field Formatter; WetKit Lightbox.
*/
function wetkit_widgets_field_formatter_wetkit_widgets_lightbox($variables) {
// Formatter settings.
$settings = $variables['#display']['settings'];
$output = '';
drupal_add_css(".wet-boew-lightbox ul {margin-left:0 !important;}
.wet-boew-lightbox img.wetkit-image-half { margin-top: 0px; }
.wet-boew-lightbox ul li {list-style-type:none; float:left; margin: 0 5px 0 0;}
.wet-boew-lightbox ul li.box {margin-bottom: 0.4em;}
.wet-boew-lightbox li img {margin-bottom:0;}
.wet-boew-lightbox ul li a {text-decoration: none;}", 'inline');
foreach (element_children($variables['#items']) as $delta) {
$item = $variables['#items'][$delta];
// Take into account multilingual.
$file = entity_load('file', array($item['fid']));
foreach($file as $single_file) {
$field_file_alt = field_get_items('file', $single_file, 'field_file_image_alt_text', 'en');
if (isset($field_file_alt)) {
$alt = $field_file_alt[0]['safe_value'];
}
$field_file_title = field_get_items('file', $single_file, 'field_file_image_title_text');
if (isset($field_file_title)) {
$title = $field_file_title[0]['safe_value'];
}
}
$source = theme('image_style', array(
'alt' => $alt,
'style_name' => $settings['image_style_source'],
'path' => $item['uri'],
));
//$destination = image_style_path($settings['image_style_destination'], $item['uri']);
$destination = $item['uri'];
$output .= '<li>' . l($source, file_create_url($destination), array(
'html' => TRUE,
'attributes' => array(
'class' => array('lb-item'),
'title' => isset($title) ? $title : '',
),
)) . '</li>';
}
$class = $settings['custom_class'];
return '<div class="wet-boew-lightbox ' . $class . '"><ul>' . $output . '</ul></div><div class="clear"></div>';
}
/**
* Field Formatter; WetKit Share Widget.
*/
function wetkit_widgets_field_formatter_wetkit_widgets_share($variables) {
// Formatter settings.
$settings = $variables['#display']['settings'];
$sites = '';
foreach ($variables['#items'] as $item) {
$sites[] = "'" . $item['value'] . "'";
}
$class = $settings['custom_class'];
if (!empty($sites)) {
$sites = implode(",", $sites);
}
return '<div class="wet-boew-share ' . $class . '" data-wet-boew="{sites:[' . $sites . ']}"></div><div class="clear"></div>';
}