This is the last part of the template creation and configuration. This should be a short post too. In the next part we will dive into some exciting coding. I will be blogging about Google OAuth authentication for accessing my youtube channel. But, let’s get done with the painful part, which ends in this 3rd part of the blog.
First of all, I have to create a branch template for the account creation. Why branch template? When I create a Youtube Account item, I want to create the whole hierarchy under that. The Account Item structure should look like below
Media Framework |_Accounts |_MyYoutubeVideos Account |_Media Content |_Players |_Settings
Here is the branch template that I created for generating above Item structure. The ‘Media Content’ folder is configured as Bucket. It will store the Video and Playlist items. The Player folder will contain different types of player available for the Account created from this branch template. Setting contains the default settings for the Account.
The Account Item from the above branch template will be created through a command template. Below is the command template and the corresponding command.
There are two parameters passed to this command, the Id of the branch template and Id of the ‘/sitecore/system/Modules/Media Framework/Settings/MyYoutubeVideos Account Settings’. When I will add the account in ‘/sitecore/media library/Media Framework/Accounts’ using the command template, it will run the Execute method from Sitecore.MediaFramework.Commands.CreateAccount class as seen in the Sitecore.MediaFramework.config.
Let’s add an insert option rule for the account creation. When I select the Accounts folder in ‘/sitecore/media library/Media Framework’ I want to see what type of item can be created. Following is Insert Option rule needed for this purpose.
As a result of this, when I select the Accounts folder in ‘/sitecore/media library/Media Framework’, it shows me that, I can create item from ‘MyYoutueVideos Account’ command template.
Similar to above insert options rule, I can create rules for other folders. For example, I can create rule for ‘Media Content’ folder, where user can create videos and playlists.
I am done with all templates and configuration, let’s create the new account under ‘/sitecore/media library/Media Framework/Accounts’. And, here how it looks.
That ClientId and ClientSecret will be filled up in the next post, when I will discuss about the Google OAuth authentication.
Almost done. I just want to create one more rule, so that, ‘Import All’ command button I created in the first blog post only shows up when I select the above ‘MyYoutubeVideos Account’ folder, because, that’s where I will be importing the videos and playlists. Here is the rule. This is a CommandStateRule.
That ends the part 3 of the blog. Next blog I will write about Google OAuth authentication from Sitecore.