You are here

function scald_youtube_form_scald_admin_type_form_alter in Scald YouTube 7

Implements hook_form_FORM_ID_alter().

File

./scald_youtube.module, line 599
Defines a YouTube provider for Scald.

Code

function scald_youtube_form_scald_admin_type_form_alter(&$form, &$form_state, $form_id) {
  if ($form['atom_type']['#value'] === 'video') {
    $form['defaults']['scald_youtube'] = array(
      '#type' => 'fieldset',
      '#title' => t('Scald YouTube Configuration'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form['defaults']['scald_youtube']['scald_youtube_api_key'] = array(
      '#type' => 'textfield',
      '#title' => t('YouTube API Key'),
      '#element_validate' => array(
        'scald_youtube_validate_api_key',
      ),
      '#default_value' => variable_get('scald_youtube_api_key', ''),
      '#description' => t('The API Key can be requested on the Google Developer Console. Without it the YouTube Search and some of the video information will not be accessible.'),
    );
    $form['defaults']['scald_youtube']['scald_youtube_show_related'] = array(
      '#type' => 'checkbox',
      '#default_value' => variable_get('scald_youtube_show_related', TRUE),
      '#title' => t('Show related videos by default'),
      '#description' => t('If checked the related videos will be visible at the end of the video by default for new Atoms.'),
    );
    $form['defaults']['scald_youtube']['scald_youtube_autoplay'] = array(
      '#type' => 'checkbox',
      '#default_value' => variable_get('scald_youtube_autoplay', FALSE),
      '#title' => t('Autoplay the video'),
      '#description' => t('If checked, the video will be set to automatically start by default for new Atoms.'),
    );
    $form['defaults']['scald_youtube']['scald_youtube_delayed_cookie'] = array(
      '#type' => 'checkbox',
      '#default_value' => variable_get('scald_youtube_delayed_cookie', FALSE),
      '#title' => t('Use the "delayed cookie" privacy feature'),
      '#description' => t("If this checkbox is checked, the nocookie.com domain will be used for embedding. The cache has to be cleared for the changes to take effect."),
    );
    $form['defaults']['scald_youtube']['scald_youtube_defer_videos'] = array(
      '#type' => 'checkbox',
      '#default_value' => variable_get('scald_youtube_defer_videos', FALSE),
      '#title' => t('Defer the Youtube videos'),
      '#description' => t("If this checkbox is checked, the loading of the Scald Youtube videos will be deferred to the end. The cache has to be cleared for the changes to take effect. If you use the WYSIWYG module, you must enable the 'Defer Youtube videos' plugin in your WYSIWYG profile."),
    );
    $form['defaults']['scald_youtube']['scald_youtube_consent_enable'] = array(
      '#type' => 'checkbox',
      '#default_value' => variable_get('scald_youtube_consent_enable', FALSE),
      '#title' => t('Ask user consent before displaying videos'),
      '#description' => t("If this checkbox is checked, the configured message below with a button will be displayed instead of the video in order to receive user consent. When the user agrees, the video will be shown. The cache has to be cleared for the changes to take effect. This will enable the defer option."),
    );
    $form['defaults']['scald_youtube']['scald_youtube_consent_text'] = array(
      '#type' => 'textfield',
      '#default_value' => variable_get('scald_youtube_consent_text', ''),
      '#title' => t('Consent text'),
      '#description' => t("This text will be displayed instead of the video until the user gives his consent."),
    );
    $form['defaults']['scald_youtube']['scald_youtube_consent_button'] = array(
      '#type' => 'textfield',
      '#default_value' => variable_get('scald_youtube_consent_button', 'Accept'),
      '#title' => t('Consent button'),
      '#description' => t("This text will be used as the button label in order to get the user consent."),
    );
    $form['defaults']['scald_youtube']['scald_youtube_thumb_size'] = array(
      '#type' => 'select',
      '#title' => t('Size of thumbnails'),
      '#default_value' => variable_get('scald_youtube_thumb_size', 'default'),
      '#options' => array(
        'default' => t('Default resolution'),
        'medium' => t('Medium resolution'),
        'high' => t('High resolution'),
        'standard' => t('Standard resolution'),
        'maxres' => t('Max resolution'),
      ),
      '#description' => t('Choose the size of thumbnails that is used to save to the local file system'),
    );
    $form['#submit'][] = 'scald_youtube_configuration_submit';
  }
}