Artesaos\SEOTools\SEOMeta::addMeta PHP Метод

addMeta() публичный Метод

Add a custom meta tag.
public addMeta ( string | array $meta, string $value = null, string $name = 'name' ) : Artesaos\SEOTools\Contracts\MetaTags
$meta string | array
$value string
$name string
Результат Artesaos\SEOTools\Contracts\MetaTags
    public function addMeta($meta, $value = null, $name = 'name')
    {
        // multiple metas
        if (is_array($meta)) {
            foreach ($meta as $key => $value) {
                $this->metatags[$key] = [$name, $value];
            }
        } else {
            $this->metatags[$meta] = [$name, $value];
        }
        return $this;
    }

Usage Example

Пример #1
0
 public function test_set_reset()
 {
     $expected = "<title>It's Over 9000!</title>";
     $expected .= "<meta name=\"description\" content=\"For those who helped create the Genki Dama\">";
     $this->seoMeta->setDescription('test');
     $this->seoMeta->addKeyword('test');
     $this->seoMeta->setNext('test');
     $this->seoMeta->setPrev('test');
     $this->seoMeta->setCanonical('test');
     $this->seoMeta->addMeta('test');
     $this->seoMeta->addAlternateLanguage('test', 'test');
     $this->seoMeta->reset();
     $this->setRightAssertion($expected);
 }