\SilverStripeYouTubeVideo
Class SilverStripeSilverStripeYouTubeVideo
Synopsis
class SilverStripeYouTubeVideo
extends YouTubeDataObject
{
- // members
- private static string $singular_name = 'YouTube Video';
- private static string $plural_name = 'YouTube Videos';
- private static string $description = 'A video from YouTube. The video can be a single video, or a video from a playlist.';
- private static array $db = ;
- private static array $belongs_many_many = ;
- private static array $casting = ;
- private $likes;
- private $video_data;
- private int|bool $views;
- private static array $indexes = ;
- public static array $allowed_actions = ;
- // methods
- public FieldList getCMSFields()
- public ValidationResult validate()
- public void onBeforeWrite()
- protected string|bool extractVideoID()
- public int getLikes()
- public $this setLikes()
- public HTMLText getEmbedCode()
- public mixed getVideoCMSPreview()
- public $this setYouTubeData()
- public mixed getYouTubeData()
- public bool|int getViews()
- public $this setViews()
- // Inherited methods from YouTubeDataObject
- public mixed getYouTubeClient()
- public $this setYouTubeClient()
- protected void logError()
- public null|bool DataValue()
- protected null|string formatData()
- public array getYouTubeData()
- protected static array data_to_array()
Hierarchy
Extends
Members
private
- $belongs_many_many — array
- $casting — array
- $db — array
- $description — string
- $indexes — array
- $likes — int
- $plural_name — string
- $singular_name — string
- $video_data —
- $views — int|bool
public
- $allowed_actions — array
Methods
protected
- extractVideoID() — Check provided url for known YouTube url pattern. {@link https://ctrlq.org/code/19797-regex-youtube-id}
public
- getCMSFields()
- getEmbedCode() — Return Video Embed code via a SilverStripe include
- getLikes() — Return total like count for this video from YouTube
- getVideoCMSPreview() — Video preview, the base embed provided by the YouTube API
- getViews() — Return this video's View count
- getYouTubeData() — Return this video's YouTube data
- onBeforeWrite() — Before writing the record, save the video ID for easier access later.
- setLikes() — Set total like count for this video from YouTube
- setViews() — Set this video's View count
- setYouTubeData() — Set YouTube video data
- validate()
Inherited from YouTubeDataObject
protected
- data_to_array() — Convert stdClass data structure to an associative array.
- formatData() — Format data passed in. Attempts to format whole numbers.
- logError() — Log or trigger an error based on environment
public
- DataValue() — Attempt to get the YouTube data based on api key/val pairs.
- getYouTubeClient() — Get reusable YouTube API Client
- getYouTubeData() — Return YouTube data array
- setYouTubeClient() — Set reusable YouTube API Client