You are here

function video_embed_field_get_form in Video Embed Field 7.2

Same name and namespace in other branches
  1. 7 video_embed_field.module \video_embed_field_get_form()

Creates a form from the player configuration options.

Parameters

array $defaults: The default settings for the various fields.

Return value

array The configuration form array.

1 call to video_embed_field_get_form()
video_embed_field_video_style_form in ./video_embed_field.admin.inc
Video embed style form handler.

File

./video_embed_field.module, line 286
Provides a simple field for easily embedding videos from youtube or vimeo

Code

function video_embed_field_get_form($defaults) {
  $form = array();
  $handlers = video_embed_get_handlers();
  foreach ($handlers as $name => $handler) {
    if (isset($handler['form']) && function_exists($handler['form'])) {
      $handler_defaults = isset($defaults[$name]) ? $defaults[$name] : array();
      $handler_defaults = array_merge($handler['defaults'], $handler_defaults);
      $form[$name] = call_user_func($handler['form'], $handler_defaults);
      $form[$name] += array(
        '#type' => 'fieldset',
        '#title' => t('@provider settings', array(
          '@provider' => $handler['title'],
        )),
        '#tree' => TRUE,
        '#element_validate' => isset($handler['form_validate']) ? array(
          $handler['form_validate'],
        ) : array(),
      );
    }
  }
  return $form;
}