PHP code example of toastnz / youtubefield

1. Go to this page and download the library: Download toastnz/youtubefield library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

toastnz / youtubefield example snippets




use EdgarIndustries\YouTubeField\YouTubeField;

class Page extends SiteTree
{

    private static $db = array(
        'VideoID' => 'Varchar(11)',
    );
    
    public function getCMSFields() {
        $fields = parent::getCMSFields();
        $fields->addFieldToTab('Root.Main', new YouTubeField('VideoID', 'YouTube Video'));
        return $fields;
    }
    
}

YouTubeField::url_parser($url);