Last active
August 29, 2015 14:05
-
-
Save Kcko/522ec2319017dc8f7bdd to your computer and use it in GitHub Desktop.
Ukázková komponenta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
class OpenGraphControl extends Nette\Application\UI\Control | |
{ | |
/** @var Nette\Utils\Html[] */ | |
private $tags = []; | |
public function addOgTag($property, $content) | |
{ | |
$this->tags[] = Nette\Utils\Html::el('meta', [ | |
'property' => $property, | |
'content' => $content, | |
]); | |
return $this; | |
} | |
public function render() | |
{ | |
$el = Nette\Utils\Html::el(); | |
foreach ($this->tags as $tag) { | |
$el->add($tag); | |
} | |
echo $el; | |
} | |
} | |
$this['openGraph']->addOgTag('og:video', 'http://www.youtube.com/watch?v=' . $this->content->url); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment