appmanschap / craft-playlister
Import Playlists directly into CraftCMS
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Type:craft-plugin
Requires
- php: >=8.2
- craftcms/cms: ^5.0.0
- google/apiclient: ^2.15.0
Requires (Dev)
- craftcms/ecs: dev-main
- craftcms/phpstan: dev-main
README
Playlister for Craft CMS
Playlister is a CraftCMS plugin for importing YouTube playlists into Craft. Retrieve the playlists and the corresponding videos.
Requirements
This plugin requires CraftCMS 5.0.0 or later.
Installation
To install the plugin, either install it from the plugin store, or follow these instructions:
- Install with composer
composer require appmanschap/craft-playlister
- Install the plugin
craft plugin/install craft-playlister
- Add your YouTube API token in the settings.
Usage
You can retrieve playlists & videos either by using Fields the Template variables. Both scenarios will return a Playlist element or Video element
Fields
Create a new Playlist Field or Video Field and add it to your entry type.
Template variables
craft.playlister.playlists()
Returns a PlaylistQuery. Query as you like to retrieve the playlists. Example (retrieve enabled playlists):
craft.playlister.playlists.enabled(true).all()
Retrieve a single playlist by the playlist id
craft.playlister.playlists.playlistId(YOUR-PLAYLIST-ID).one()
craft.playlister.videos()
Returns a VideoQuery. Query as you like to retrieve the videos.
Retrieve embeddable videos example
craft.playlister.videos.embeddable(true).all()
Retrieve videos from a playlist
craft.playlister.videos.playlistId(YOUR-PLAYLIST-ID).all()
Retrieve videos with tags example
craft.playlister.videos.tags[('awesome', 'video']).all()
Playlist element
Method: getVideos(?bool embeddable)
Retrieve the videos of the playlist. The embeddable parameter will filter the query by it's value when it's available.
Video element
Method: getThumbnail(string size)
The method will return the first possible thumbnail url by it's given size. If no parameter is passed then it will retrieve it's known largest thumbnail url.
Possible sizes:
- default
- medium
- high
- standard
- maxres
Support
Get in touch by creating a Github issue