You are here

function swftools_admin_embed_form in SWF Tools 6

Same name and namespace in other branches
  1. 5 swftools.module \swftools_admin_embed_form()
  2. 6.3 includes/swftools.admin.inc \swftools_admin_embed_form()
  3. 6.2 swftools.admin.inc \swftools_admin_embed_form()
1 string reference to 'swftools_admin_embed_form'
swftools_menu in ./swftools.module
Implementation of hook_menu().

File

./swftools.admin.inc, line 3

Code

function swftools_admin_embed_form() {

  // Clear all caches
  drupal_flush_all_caches();
  $swf_options = _swftools_options();
  drupal_add_css(drupal_get_path('module', 'swftools') . '/swftools.admin.css', 'module', 'all', FALSE);

  //$playlist_path = file_create_path(variable_get('swftools_playlist_path', SWFTOOLS_PLAYLIST_PATH));
  $playlist_path = swftools_get_playlist_path();
  $player_directory = swftools_get_player_path() . '/';
  $form = array();
  $form['swftools_method'] = array(
    '#type' => 'fieldset',
    '#title' => t('Embedding methods'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $methods = swftools_methods_available(SWFTOOLS_EMBED_METHOD);
  if (count($methods)) {
    foreach ($methods as $method => $info) {
      if (!file_exists($player_directory . $info['shared_file'])) {
        $swf_embed_methods[$method] = $info['title'] . ' - <span class="error">Missing</span>';
        if ($info['download']) {
          $swf_embed_methods[$method] = $swf_embed_methods[$method] . ' - ' . l(t('Download here'), $info['download']);
        }
      }
      else {
        $swf_embed_methods[$method] = $info['title'];
      }
    }
  }
  $form['swftools_method'][SWFTOOLS_EMBED_METHOD] = array(
    '#type' => 'radios',
    '#title' => t('Method'),
    '#default_value' => variable_get(SWFTOOLS_EMBED_METHOD, SWFTOOLS_NOJAVASCRIPT),
    '#options' => $swf_embed_methods,
    '#description' => t('Choose the method that will be used for Flash replacement. JavaScript methods
                         require supporting JavaScript files to be downloaded and added to an appropriate
                         sub-directory of <em>%default</em>. Direct embedding is built in to SWF Tools.', array(
      '%default' => t(drupal_get_path('module', 'swftools') . '/shared'),
    )),
  );

  // Might have another setting like above for SIFR, if it ever gets used
  $form['swftools_method']['swftools_always_add_js'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add JavaScript to all pages'),
    '#default_value' => variable_get('swftools_always_add_js', SWFTOOLS_ALWAYS_ADD_JS),
    '#description' => t('Modules such as filters result in caching of the mark up generated
                         to display Flash content. In these cases SWF Tools will not be
                         triggered to add the necessary JavaScript to the page and the Flash
                         content will not display. Enable this setting to push the necessary
                         JavaScript into the header of every page. This will ensure that cached
                         filter results are processed correctly.
                         '),
  );

  /**
    // This feature is not yet implemented
    $form['swftools_method']['swftools_user_no_js'] = array(
      '#type' => 'checkbox',
      '#title' => t('Allow users to override embedding methods'),
      '#disabled' => TRUE,
      '#default_value' => variable_get('swftools_user_no_js', FALSE),
      '#description' => t('User can choose how Flash content is delivered overriding
                           the \'Method\' setting above. Adds a setting to the profile page.'),
    );
  **/
  $form['swftools_method']['swftools_html_alt'] = array(
    '#type' => 'textarea',
    '#title' => t('HTML alternative'),
    '#default_value' => variable_get('swftools_html_alt', SWFTOOLS_DEFAULT_HTML_ALT),
    '#description' => t('Enter the default HTML that will appear if the Flash
                         content cannot be embedded.'),
  );
  $form['swftools_params'] = array(
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#title' => t('Default settings for embedding'),
    '#description' => t('Please refer to !technote for more details about each setting.
                         If you are looking for the \'base\' option, this is defined
                         in the \'File Locations\' settings above.', array(
      '!technote' => l('Adobe technote 12701', 'http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701'),
    )),
  );
  $form['swftools_params']['swftools_params_version'] = array(
    '#type' => 'textfield',
    '#size' => '5',
    '#title' => 'Flash version',
    '#default_value' => variable_get('swftools_params_version', '7'),
  );
  $form['swftools_params']['swftools_params_play'] = array(
    '#type' => 'checkbox',
    '#title' => t('<strong>Play immediately</strong> (play)'),
    '#default_value' => variable_get('swftools_params_play', TRUE),
  );
  $form['swftools_params']['swftools_params_loop'] = array(
    '#type' => 'checkbox',
    '#title' => t('<strong>Loop movie</strong> (loop) .'),
    '#default_value' => variable_get('swftools_params_loop', TRUE),
  );
  $form['swftools_params']['swftools_params_menu'] = array(
    '#type' => 'checkbox',
    '#title' => t('<strong>Full menu</strong> (menu) Displays the full menu, allowing
                   the user a variety of options to enhance or control playback.'),
    '#default_value' => variable_get('swftools_params_menu', FALSE),
  );
  $form['swftools_params']['swftools_params_allowfullscreen'] = array(
    '#type' => 'checkbox',
    '#title' => t('<strong>Allow full screen mode</strong> (allowfullscreen)'),
    '#default_value' => variable_get('swftools_params_allowfullscreen', TRUE),
  );
  $form['swftools_params']['swftools_params_bgcolor'] = array(
    '#type' => 'textfield',
    '#title' => t('Background color <span class="weight-normal">(bgcolor)</span>'),
    '#size' => 7,
    '#maxlength' => 7,
    '#required' => TRUE,
    '#default_value' => variable_get('swftools_params_bgcolor', '#FFFFFF'),
    '#description' => t('Hexadecimal background color in the form #RRGGBB.'),
  );
  $form['swftools_params']['swftools_params_quality'] = array(
    '#type' => 'select',
    '#title' => t('Quality') . ' <span class="weight-normal">(quality)</span>',
    '#default_value' => variable_get('swftools_params_quality', 'autohigh'),
    '#options' => $swf_options['quality'],
  );
  $form['swftools_params']['swftools_params_scale'] = array(
    '#type' => 'select',
    '#title' => t('Scale') . ' <span class="weight-normal">(scale)</span>',
    '#default_value' => variable_get('swftools_params_scale', 'showall'),
    '#options' => $swf_options['scale'],
  );
  $form['swftools_params']['swftools_params_wmode'] = array(
    '#type' => 'select',
    '#title' => t('Window mode') . ' <span class="weight-normal">(wmode)</span>',
    '#default_value' => variable_get('swftools_params_wmode', 'opaque'),
    '#options' => $swf_options['wmode'],
  );
  $form['swftools_params']['swftools_params_align'] = array(
    '#type' => 'select',
    '#title' => t('Align') . ' <span class="weight-normal">(align)</span>',
    '#default_value' => variable_get('swftools_params_align', 'l'),
    '#options' => $swf_options['align'],
  );
  $form['swftools_params']['swftools_params_salign'] = array(
    '#type' => 'select',
    '#title' => t('salign') . ' <span class="weight-normal">(salign)</span>',
    '#default_value' => variable_get('swftools_params_salign', 'tl'),
    '#options' => $swf_options['salign'],
  );
  $form['swftools_params']['swftools_params_swliveconnect'] = array(
    '#type' => 'select',
    '#options' => array(
      'true' => 'Yes',
      'default' => 'No',
    ),
    // 'default' setting will simple omit this value for simplicity.
    '#title' => t('Load Java') . ' <span class="weight-normal">(swliveconnect)</span>',
    '#default_value' => variable_get('swftools_params_swliveconnect', 'default'),
  );
  return system_settings_form($form);
}