Commit ff4036d0 authored by guschilds's avatar guschilds

Improved function documentation.

parent cd623524
...@@ -27,7 +27,10 @@ function youtube_get_video_id($input) { ...@@ -27,7 +27,10 @@ function youtube_get_video_id($input) {
} }
/** /**
* Returns a list of standard YouTube video sizes. * Returns a list of YouTube video size options.
*
* @return array
* An array of options, keyed by machine name with human readable values.
*/ */
function youtube_size_options() { function youtube_size_options() {
return array( return array(
...@@ -42,6 +45,9 @@ function youtube_size_options() { ...@@ -42,6 +45,9 @@ function youtube_size_options() {
/** /**
* Returns a list of thumbnail link types. * Returns a list of thumbnail link types.
*
* @return array
* An array of link types, keyed by machine name with human readable values.
*/ */
function youtube_thumbnail_link_types() { function youtube_thumbnail_link_types() {
$link_types = array( $link_types = array(
...@@ -56,7 +62,18 @@ function youtube_thumbnail_link_types() { ...@@ -56,7 +62,18 @@ function youtube_thumbnail_link_types() {
} }
/** /**
* Splits height and width when given size, as from youtube_size_options. * Determines the height and width when given a player size.
*
* @param string $size
* (optional) The machine name of the size from youtube_size_options().
* @param string $width
* (optional) The width input for custom dimensions.
* @param string $height
* (optional) The height input for custom dimensions.
*
* @return array
* An array keyed by 'width' and 'height' with the values to use when theming
* the video player.
*/ */
function youtube_get_dimensions($size = NULL, $width = NULL, $height = NULL) { function youtube_get_dimensions($size = NULL, $width = NULL, $height = NULL) {
$dimensions = array(); $dimensions = array();
...@@ -218,9 +235,10 @@ function youtube_thumb_delete_all($form, &$form_state) { ...@@ -218,9 +235,10 @@ function youtube_thumb_delete_all($form, &$form_state) {
* Get YouTube image path by building correctly formed URL. * Get YouTube image path by building correctly formed URL.
* *
* @param $video_id * @param $video_id
* The ID of the video to grab the thumbnail from. * (optional) The ID of the video to grab the thumbnail from.
* @param $version * @param $version
* Which version of the thumbnail to grab. * (optional) Which version of the thumbnail to grab.
*
* @return string * @return string
* The youtube.com image path to the specified version/video. * The youtube.com image path to the specified version/video.
*/ */
...@@ -250,15 +268,6 @@ function youtube_build_remote_image_path($video_id = NULL, $version = '0') { ...@@ -250,15 +268,6 @@ function youtube_build_remote_image_path($video_id = NULL, $version = '0') {
* Implements hook_feeds_processor_targets_alter(). * Implements hook_feeds_processor_targets_alter().
* *
* Adds a target option for YouTube fields to Feeds mapping options. * Adds a target option for YouTube fields to Feeds mapping options.
*
* @param &$targets
* Array containing the targets to be offered to the user. Add to this array
* to expose additional options. Remove from this array to suppress options.
* Remove with caution.
* @param $entity_type
* The entity type of the target, for instance a 'node' entity.
* @param $bundle_name
* The bundle name for which to alter targets.
*/ */
function youtube_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) { function youtube_feeds_processor_targets_alter(&$targets, $entity_type, $bundle_name) {
foreach (field_info_instances($entity_type, $bundle_name) as $name => $instance) { foreach (field_info_instances($entity_type, $bundle_name) as $name => $instance) {
...@@ -330,9 +339,6 @@ function youtube_set_target($source, $entity, $target, $value, $mapping) { ...@@ -330,9 +339,6 @@ function youtube_set_target($source, $entity, $target, $value, $mapping) {
* Implements hook_token_info_alter(). * Implements hook_token_info_alter().
* *
* Alters and adds tokens for each youtube field. * Alters and adds tokens for each youtube field.
*
* @param $data
* The associative array of token definitions from hook_token_info().
*/ */
function youtube_token_info_alter(&$data) { function youtube_token_info_alter(&$data) {
// Get all youtube fields. Gather entity_type and bundle information. // Get all youtube fields. Gather entity_type and bundle information.
...@@ -375,28 +381,7 @@ function youtube_token_info_alter(&$data) { ...@@ -375,28 +381,7 @@ function youtube_token_info_alter(&$data) {
} }
/** /**
* Provide replacement values for placeholder tokens. * Implements hook_tokens().
*
* Replaces youtube_video_url and youtube_image_url tokens.
*
* @param $type
* The machine-readable name of the type (group) of token being replaced, such
* as 'node', 'user', or another type defined by a hook_token_info()
* implementation.
* @param $tokens
* An array of tokens to be replaced. The keys are the machine-readable token
* names, and the values are the raw [type:token] strings that appeared in the
* original text.
* @param $data
* (optional) An associative array of data objects to be used when generating
* replacement values, as supplied in the $data parameter to token_replace().
* @param $options
* (optional) An associative array of options for token replacement; see
* token_replace() for possible values.
*
* @return
* An associative array of replacement values, keyed by the raw [type:token]
* strings from the original text.
* *
* @see youtube_tokens_info_alter() * @see youtube_tokens_info_alter()
*/ */
...@@ -421,7 +406,7 @@ function youtube_tokens($type, $tokens, array $data = array(), array $options = ...@@ -421,7 +406,7 @@ function youtube_tokens($type, $tokens, array $data = array(), array $options =
foreach ($tokens as $name => $original) { foreach ($tokens as $name => $original) {
if (!strpos($name, '__youtube_')) { if (!strpos($name, '__youtube_')) {
// This isn't a youtube token! // This isn't a YouTube Field token!
continue; continue;
} }
......
...@@ -35,7 +35,7 @@ function youtube_permission() { ...@@ -35,7 +35,7 @@ function youtube_permission() {
} }
/** /**
* Settings form for YouTube field module. * Settings form for the YouTube Field module's configuration page.
*/ */
function youtube_settings_form($form) { function youtube_settings_form($form) {
$form = array(); $form = array();
...@@ -176,9 +176,12 @@ function youtube_property_info_callback(&$info, $entity_type, $field, $instance, ...@@ -176,9 +176,12 @@ function youtube_property_info_callback(&$info, $entity_type, $field, $instance,
} }
/** /**
* Defines info for the properties of youtube field data. * Defines info for the properties of YouTube field data.
*
* @return array
* An array of property information for YouTube fields, keyed by property.
*/ */
function youtube_field_data_property_info($name = NULL) { function youtube_field_data_property_info() {
return array( return array(
'input' => array( 'input' => array(
'label' => t('YouTube URL'), 'label' => t('YouTube URL'),
...@@ -581,7 +584,7 @@ function youtube_field_widget_form(&$form, &$form_state, $field, $instance, $lan ...@@ -581,7 +584,7 @@ function youtube_field_widget_form(&$form, &$form_state, $field, $instance, $lan
} }
/** /**
* Validation for the youtube field itself. * Validation for YouTube fields.
*/ */
function youtube_input_validate($element, &$form_state, $form) { function youtube_input_validate($element, &$form_state, $form) {
$input = $element['#value']; $input = $element['#value'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment