YouTube Video Picker Field

  0 rating
3/19/2014 1:21:20 AM
4/17/2015 1:39:59 PM
Source: Github
Provider: BrainJocks

About

Building a custom field type in Sitecore with support for Content and Page Editor isn’t particularly hard. Specifically, for a “picker” field you would need:

  • New field type definition in the core database
  • New field type backing class
  • Content Editor control with select and clear message handlers
  • XML control (markup and codebeside) that renders the ‘picker’ dialog
  • WebEdit command for Page Editor
  • renderField pipeline extension to customize how field value renders in Page Editor
  • renderContentEditor pipeline extension to bring in extra resources into Content Editor

Here at BrainJocks we have recently created a few of these experiences and decided to open source one -YouTube Video Picker.

It’s a fully workable solution. Feel free to use it in your project or explore as a study guide. We also published a series of blog posts about it:

Documentation

Documentation
  • Documentation > INSTALL
    INSTALL

    The project usesTDS and is structured the way we structure all our Sitecore projects (more details here - part 1part 2). Once you pull it down please:

    • Copy your Sitecore.KernelSitecore.Client, and Sitecore.Mvc into ./Libs/Sitecore if you are building against something other than Sitecore 7 Update 2
    • Add your Google API license key into BrainJocks.YouTube.Web/sitecore modules/BrainJocks/resources/brainjocks.youtubesearch.init.js
    0
Back
Release notes
v1.0.0. Tested in Sitecore 7.0 Update 2 but will probably work fine with 6.5+
Read more Back
Code examples
  • Code examples > Example
    HOW TO

    The raw value of the field is the YouTube video ID so you can render it any way you like on the actual website. Content Editor experience is built-in. When it comes to Page Editor, the pipeline extensions will do all the work so all you do is:

    @Html.Sitecore().Field("Video One")
    

    to render a default (small) thumbnail or:

    @Html.Sitecore().Field("Video One", new { Size = YouTubeVideoField.ThumbnailSize.Medium})
    

    to specify the size of how you like the thumbnail rendered.

    We are 100% MVC with Sitecore but the field type itself has no MVC dependency and can be as easily used with other rendering technologies

    0

Solution screenshots(0)

Upload

Reviews (0)

Sort by: Date Most votes
  • Profile Avatar
    [fullName]

    Level: 0

    x0 x0 x0

    [date]

    [title]

    [text]

    Was this helpful?

    0

Comments (0)

Sort by: Date  Most votes

Leave a Comment

Comment must be field in
Post comment
loader

Write a review

Title can't be empty
Review can't be empty
Post review

Download

Title Description Download Action

Add File