The module is a plugin for App::ZofCMS. It provides means to have a CRUD-like (Create, Read, Update, Delete) interface for managing YouTube videos. The plugin provides a form where a user can enter the title of the video, its YouTube URI and a description. That form is stored in a SQL database by the plugin and can be displayed as a list.

The plugin takes its config via plug_youtube first-level key that takes a hashref or a subref as a value and can be specified in either Main Config File or ZofCMS Template or both. or a subref as a value. If subref is specified, its return value will be assigned to plug_youtube as if it was already there. If sub returns an undef, then plugin will stop further processing. The @_ of the subref will contain (in that order): ZofCMS Tempalate hashref, query parameters hashref and App::ZofCMS::Config object. If a certain key (does NOT apply to subrefs) in that hashref is set in both, Main Config File and ZofCMS Template, the value for that key that is set in ZofCMS Template will take precendence. The possible keys/values are as follows (virtually all are optional and have default values):

Optional. When set to a true value, the plugin will automatically create needed SQL table, you can create it manually if you wish, see its format in USED SQL TABLE FORMAT section above. Generally you'd set this to a true value only once, at the start, and then you'd remove it because there is no "IF EXISTS" checks. Defaults to:0

Optional. Takes a string as a value. This string will be used as a "base name" for two keys that plugin generates in {t} special key. The keys are plug_youtube_list and plug_youtube_form (providing t_name is set to default) and are explained below in HTML::Template VARIABLES section below. Defaults to:plug_youtube

Optional. Takes either an integer from 0 to 3 or an arrayref with two elements that are positive intergers as a value. When the value is an arrayref the first element is treated as the value of width="" attribute and the second element is treated as the value for height="" attribute. These two control the size of the video. You can also use integers from 0 to 3 to specify a "prefabricated" size (sort'f like a shortcut). The relation between the integers and the sizes they represent is shown below. Defaults to:1 ( size 425x344)

Optional. Plugin generates an HTML form to input videos into the database, besides that, it also processes that form and makes sure everything is right. When no_form is set to a true value, the plugin will NOT generate the form and most importantly it will NOT process anything; so if you are making your own form for input, make sure to leave no_form as false. Defaults to:0s

Optional. Plugin automatically fetches all the available videos from the database and prepares an HTML list to present them. When no_list is set to a true value, plugin will not generate any lists. Defaults to:0

Optional. Applies only when both no_form and no_list are set to false values. Takes either true or false values. When set to a true value, plugin will add Edit and Delete buttons under every video with which the user will be able to (duh!) edit and delete videos. Defaults to:0

Note: the "edit" is not that smart in this plugin, what actually happens is the video is deleted and its information is filled in the "entry" form. If the user never hits "Add" button on the form, the video will be lost; let me know if this creates a problem for you.

Optional. You can set a filter when displaying the list of videos. The filter argument takes a hashref as a value. All keys take a regex (qr//) as a value. The field referenced by the key must match the regex in order for the video to be put in the list of videos. By default is not specified. You can specify either 1 or all 3 keys. Possible keys and what they reference are as follows:

Optional. Under the hood plugin uses LWP::UserAgent to access YouTube for fetching the "embed" code for the videos. The ua_args takes an arrayref as a value. This arrayref will be directly derefrenced into LWP::UserAgent's constructor (new() method). See LWP::UserAgent for possible options. Defaults to:[ agent => 'Opera 9.2', timeout => 30, ]

The plugin generates two keys in {t} ZofCMS Template special key, thus making them available for use in your HTML::Template templates. Assuming t_name is left at its default value the following are the names of those two keys: