diff --git a/README.md b/README.md
index ca24f24..032a94f 100644
--- a/README.md
+++ b/README.md
@@ -38,6 +38,9 @@ Metabase secret key can be found in metabase settings page (only accessible by a
@php($params = ['category' => 'php'])
// BEWARE of the colon in ":params" (not "param") because we are passing array variable directly to the component
+
+
+
```
## Common Problems
diff --git a/src/MetabaseComponent.php b/src/MetabaseComponent.php
index f79fb5f..b9427ea 100644
--- a/src/MetabaseComponent.php
+++ b/src/MetabaseComponent.php
@@ -10,6 +10,12 @@ class MetabaseComponent extends Component
public ?int $question;
+ public bool $bordered;
+
+ public bool $titled;
+
+ public ?string $theme;
+
/**
* @var string[]
*/
@@ -22,11 +28,14 @@ class MetabaseComponent extends Component
* @param int|null $question
* @param array $params
*/
- public function __construct(?int $dashboard = null, ?int $question = null, array $params = [])
+ public function __construct(?int $dashboard = null, ?int $question = null, array $params = [], $bordered = false, $titled = false, $theme = null)
{
$this->dashboard = $dashboard;
$this->question = $question;
$this->params = $params;
+ $this->bordered = $bordered;
+ $this->titled = $titled;
+ $this->theme = $theme;
}
/**
@@ -38,7 +47,21 @@ public function render()
{
$metabase = app(MetabaseService::class);
$metabase->setParams($this->params);
+ $metabase->setAdditionalParams($this->getAdditionalParams());
$iframeUrl = $metabase->generateEmbedUrl((int) $this->dashboard, (int) $this->question);
return view('metabase::iframe', compact('iframeUrl'));
}
+
+
+ private function getAdditionalParams()
+ {
+ $additionalParameters['bordered'] = $this->bordered;
+ $additionalParameters['titled'] = $this->titled;
+
+ if($this->theme) {
+ $additionalParameters['theme'] = $this->theme;
+ }
+
+ return $additionalParameters;
+ }
}
diff --git a/src/MetabaseService.php b/src/MetabaseService.php
index 1f1dd06..b8d9ff0 100644
--- a/src/MetabaseService.php
+++ b/src/MetabaseService.php
@@ -14,6 +14,11 @@ class MetabaseService
*/
private $params;
+ /**
+ * @var array @params
+ */
+ private $additionalParams;
+
/**
* @param array $params
*
@@ -28,6 +33,16 @@ public function setParams(array $params): void
$this->params = $params;
}
+ /**
+ * @param array $params
+ *
+ * @return void
+ */
+ public function setAdditionalParams(array $params): void
+ {
+ $this->additionalParams = $params;
+ }
+
private string $type = 'dashboard';
/**
@@ -62,7 +77,7 @@ public function generateEmbedUrl(?int $dashboard, ?int $question): string
->toString();
return sprintf(
- '%s/embed/%s/%s#bordered=true&titled=false',
+ '%s/embed/%s/%s#' . http_build_query($this->additionalParams),
config('services.metabase.url'),
$this->type,
$token