2017 © Pedro Peláez
 

silverstripe-module youtubefield

Field for selecting YouTube videos. Takes various URL formats as input and stores the YouTube ID.

image

silverstripe-rebelalliance/youtubefield

Field for selecting YouTube videos. Takes various URL formats as input and stores the YouTube ID.

  • Monday, October 30, 2017
  • by edlinklater
  • Repository
  • 3 Watchers
  • 11 Stars
  • 7,140 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 6 Forks
  • 4 Open issues
  • 6 Versions
  • 2 % Grown

The README.md

ABANDONED! Use the fork toastnz/youtubefield., (*1)

YouTube Field for SilverStripe

Introduction

This SilverStripe module provides a YouTube field for use in the CMS/ModelAdmin. It accepts input of various common YouTube URL formats and converts them for storage in database as the 11-character YouTube ID., (*2)

Once a valid ID is saved the field will display the video's thumbnail and title., (*3)

Optionally you can provide a key for the YouTube v3 API, which is used to display additional information (duration and view count) and provides information immediately (rather than after saving)., (*4)

Screenshot of Video Information, (*5)

Requirements

  • silverstripe/framework ^4.0 (See 1 branch for SilverStripe 3 compatibility)

Basic field

mysite/code/Page.php, (*6)

<?php

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;
    }

}

mysite/_config/config.yml, (*7)

EdgarIndustries\YouTubeField\YouTubeField:
  api_key: YOUR_API_KEY

URL Parser

There is a static function which can be called (without using the YouTubeField) to simply retrieve the YouTube ID from a supported URL format., (*8)

YouTubeField::url_parser($url);

The Versions

30/10 2017

dev-master

9999999-dev

Field for selecting YouTube videos. Takes various URL formats as input and stores the YouTube ID.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe youtube formfield

30/10 2017

1.0

1.0.0.0

Field for selecting YouTube videos. Takes various URL formats as input and stores the YouTube ID.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe youtube formfield

18/01 2017

0.2

0.2.0.0

Field for selecting YouTube videos. Takes various URL formats as input and stores the YouTube ID.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe youtube formfield

09/09 2015

0.1.2

0.1.2.0

Field for selecting YouTube videos. Takes various URL formats as input and stores the YouTube ID.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe youtube formfield

08/09 2015

0.1.1

0.1.1.0

Field for selecting YouTube videos. Takes various URL formats as input and stores the YouTube ID.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe youtube formfield

23/07 2015

0.1

0.1.0.0

Field for selecting YouTube videos. Takes various URL formats as input and stores the YouTube ID.

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe youtube formfield