Skip to content

Instantly share code, notes, and snippets.

@Kcko
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kcko/522ec2319017dc8f7bdd to your computer and use it in GitHub Desktop.
Save Kcko/522ec2319017dc8f7bdd to your computer and use it in GitHub Desktop.
Ukázková komponenta
<?
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