Frontend\Core\Engine\Header::setTwitterCard PHP Method

setTwitterCard() public method

Set Twitter Card
public setTwitterCard ( string $title, string $description, string $imageURL, string $cardType = 'summary', string $siteHandle = null, string $creatorHandle = null )
$title string The title (maximum 70 characters)
$description string A brief description of the card (maximum 200 characters)
$imageURL string The URL of the image (minimum 280x150 and <1MB)
$cardType string The cardtype, possible types: https://dev.twitter.com/cards/types
$siteHandle string (optional) Twitter handle of the site
$creatorHandle string (optional) Twitter handle of the author
    public function setTwitterCard($title, $description, $imageURL, $cardType = 'summary', $siteHandle = null, $creatorHandle = null)
    {
        $data = array(array('name' => 'twitter:card', 'content' => $cardType), array('name' => 'twitter:title', 'content' => $title), array('name' => 'twitter:description', 'content' => $description), array('name' => 'twitter:image', 'content' => $imageURL));
        // add site handle if provided
        if ($siteHandle != null) {
            $data[] = array('name' => 'twitter:site', 'content' => $siteHandle);
        }
        // add creator handle if provided
        if ($creatorHandle != null) {
            $data[] = array('name' => 'twitter:creator', 'content' => $creatorHandle);
        }
        // add Twitter Card to the header
        foreach ($data as $d) {
            $this->addMetaData($d);
        }
    }