forked from ssovit/acf-sliders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
field-revslider.php
51 lines (48 loc) · 1.1 KB
/
field-revslider.php
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
<?php
/**
*
* Revolution Slider Field
*
*/
if ( !defined( 'ABSPATH' )) die(-1);
class WPPress_RevolutionSlider_ACF_Field extends WPPress_ACF_Field
{
function __construct() {
$this->label = 'Revolution Slider';
parent::__construct();
}
/**
* will return
* @method get_slider_output
* @author Sovit Tamrakar
* @param [type] $data accepts data in array or string/integer
* @return string output data for slider html
*/
function slider_output($data = NULL) {
ob_start();
print do_shortcode('[rev_slider alias="slider-'.$data.'"][/rev_slider]');
$slider = ob_get_contents();
ob_clean();
ob_end_clean();
return $slider;
}
/**
* Will return all the Gallery Slider in array in format(id=>name)
* @method sliders_data
* @author Sovit Tamrakar
* @return array id=>label
*/
function slider_data() {
$slider = new RevSliderSlider();
$sliders = $slider->getArrSlidersShort();
$data = array();
$data[0] = 'none';
if (!empty($sliders)) {
foreach ($sliders as $key => $val) {
$data[$key] = $val;
}
}
return $data;
}
}
new WPPress_RevolutionSlider_ACF_Field();