File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Embed \Adapters ;
4
+
5
+ use Embed \Http \Response ;
6
+ use Embed \Utils ;
7
+
8
+ /**
9
+ * Adapter to hardcode the embed code for Tableau public.
10
+ */
11
+ class Tableau extends Webpage
12
+ {
13
+ /**
14
+ * {@inheritdoc}
15
+ */
16
+ public static function DoNotUSEcheck (Response $ response )
17
+ {
18
+ // https://public.tableau.com/views/NAME_OF_VIEW/SubName?:language=en-US&:display_count=n&:origin=viz_share_link
19
+ return $ response ->isValid () && $ response ->getUrl ()->match ([
20
+ '*.public.tableau.com/views/*/* ' ,
21
+ ]);
22
+ }
23
+
24
+ /**
25
+ * {@inheritdoc}
26
+ */
27
+ public function getCode ()
28
+ {
29
+ $ this ->width = '100% ' ;
30
+ $ this ->height = '60vh ' ;
31
+
32
+ // $this->url ends up not being the same one Tableau offers when you
33
+ // copy the share link.
34
+ $ embed_url = $ this ->response ->getStartingUrl () . '&:showVizHome=no&:embed=true ' ;
35
+
36
+ return Utils::iframe ($ embed_url );
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments