Webiny\Component\Bootstrap\ApplicationClasses\View::setMeta PHP Method

setMeta() public method

Set a html meta tag.
public setMeta ( string $name, string $content )
$name string Meta name.
$content string Meta value.
    public function setMeta($name, $content)
    {
        $this->meta[$name] = $content;
        return $this;
    }

Usage Example

Ejemplo n.º 1
0
 public function testMeta()
 {
     $view = new View();
     $view->setMeta('keyword', 'testing');
     $view->setMeta('description', 'Just testing');
     $expectedArray = ['keyword' => 'testing', 'description' => 'Just testing'];
     $this->assertSame($expectedArray, $view->getMeta());
     $html = '';
     foreach ($expectedArray as $name => $content) {
         $html .= '<meta name="' . $name . '" content="' . $content . '"/>' . "\n";
     }
     $this->assertSame($html, $view->getMetaHtml());
 }