diff --git a/README.md b/README.md
index 972e3bb..474b540 100644
--- a/README.md
+++ b/README.md
@@ -121,6 +121,29 @@ $card->addMeta('author', '@the_author'); // 'http://mypage.com',
+ 'title' => 'Page title',
+ 'text' => 'Extended page description',
+ 'image' => 'http://mypage.com/image.png',
+ 'twitterUser' => '@twitterUser'
+];
+
+$page = new Page($info, [
+ 'twitter_card_type' => 'summary_large_image'
+]);
+```
## Usage in Symfony
diff --git a/src/Metas/Twittercard.php b/src/Metas/Twittercard.php
index bcef7f4..e87ca20 100644
--- a/src/Metas/Twittercard.php
+++ b/src/Metas/Twittercard.php
@@ -16,7 +16,7 @@ class Twittercard extends MetaBase implements MetaInterface
*/
protected function generateTags()
{
- $this->addMeta('card', 'summary');
+ $this->addMeta('card', $this->page->getConfig('twitter_card_type', 'summary'));
$this->addMetas($this->page->get(array(
'title',
diff --git a/src/Page.php b/src/Page.php
index 27d8255..33ebb23 100644
--- a/src/Page.php
+++ b/src/Page.php
@@ -257,16 +257,13 @@ public function get(array $info = null)
/**
* Gets one or all configuration option.
*
- * @param string|null $name
+ * @param string $name
+ * @param null $default
*
- * @return string|array|null
+ * @return mixed
*/
- public function getConfig($name = null)
+ public function getConfig($name, $default = null)
{
- if ($name === null) {
- return $this->config;
- }
-
- return isset($this->config[$name]) ? $this->config[$name] : null;
+ return isset($this->config[$name]) ? $this->config[$name] : $default;
}
}
diff --git a/tests/BasicTest.php b/tests/BasicTest.php
index bae1215..1d7c166 100644
--- a/tests/BasicTest.php
+++ b/tests/BasicTest.php
@@ -85,4 +85,23 @@ public function testMetas(Page $page)
$this->assertEquals($html, '');
$this->assertEquals($schema, '');
}
+
+ public function testOptions()
+ {
+ $info = array(
+ 'url' => 'http://example.com',
+ 'title' => 'Title',
+ 'text' => 'Description',
+ 'image' => 'http://example.com/image.png',
+ 'twitterUser' => '@example',
+ );
+
+ $page = new Page($info, array(
+ 'twitter_card_type' => 'summary_large_image'
+ ));
+
+ $twitterCard = $page->twitterCard();
+
+ $this->assertEquals('', $twitterCard['card']);
+ }
}