You are here

function jplayer_field_formatter_settings_form in jPlayer 7.2

Implements hook_field_formatter_settings_form().

1 call to jplayer_field_formatter_settings_form()
jplayer_style_plugin::options_form in includes/jplayer_style_plugin.inc
Provide a form to edit options for this plugin.

File

./jplayer.module, line 152
Provides an HTML5-compatible with Flash-fallback audio player.

Code

function jplayer_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $form = array();
  if ($display['type'] == 'jplayer_player') {
    $form['mode'] = array(
      '#title' => t('Kind'),
      '#type' => 'select',
      '#options' => array(
        'single' => t('Single'),
        'playlist' => t('Playlist'),
      ),
      '#default_value' => $settings['mode'],
    );
    $form['continuous'] = array(
      '#title' => t('Continuous play'),
      '#type' => 'select',
      '#options' => array(
        0 => t('No'),
        1 => t('Yes'),
      ),
      '#description' => t('Play the next track in a playlist automatically.'),
      '#default_value' => $settings['continuous'],
      '#states' => array(
        'visible' => array(
          ':input[name="fields[field_audio][settings_edit_form][settings][mode]"]' => array(
            'value' => 'playlist',
          ),
        ),
      ),
    );
    $form['autoplay'] = array(
      '#title' => t('Autoplay'),
      '#type' => 'select',
      '#options' => array(
        0 => t('No'),
        1 => t('Yes'),
      ),
      '#default_value' => $settings['autoplay'],
    );
    $form['solution'] = array(
      '#title' => t('Preferred solution'),
      '#type' => 'select',
      '#options' => array(
        'html, flash' => t('HTML5'),
        'flash, html' => t('Flash'),
      ),
      '#default_value' => $settings['solution'],
    );
    $form['preload'] = array(
      '#title' => t('Preload media'),
      '#type' => 'select',
      '#options' => array(
        'none' => t('No'),
        'metadata' => t('Only metadata'),
        'auto' => t('Yes'),
      ),
      '#description' => t("Preloading media before it's requested isn't available in all browsers."),
      '#default_value' => $settings['preload'],
    );
    $form['volume'] = array(
      '#title' => t('Initial volume'),
      '#type' => 'textfield',
      '#field_suffix' => '%',
      '#maxlength' => 3,
      '#size' => 3,
      '#default_value' => $settings['volume'],
      '#element_validate' => array(
        'jplayer_volume_check',
      ),
    );
    $form['muted'] = array(
      '#title' => t('Initially muted'),
      '#type' => 'select',
      '#options' => array(
        FALSE => t('No'),
        TRUE => t('Yes'),
      ),
      '#default_value' => $settings['muted'],
    );
    $form['repeat'] = array(
      '#title' => t('Repeat'),
      '#type' => 'select',
      '#options' => array(
        'all' => t('All'),
        'single' => t('Single'),
        'none' => t('None'),
      ),
      '#description' => t("For playlist players, it is suggested to enable Continuous play if setting Repeat to 'All'."),
      '#default_value' => $settings['repeat'],
    );
    $form['backgroundColor'] = array(
      '#title' => t('Background color'),
      '#type' => 'textfield',
      '#field_preffix' => '#',
      '#maxlength' => 6,
      '#size' => 6,
      '#default_value' => $settings['backgroundColor'],
    );
  }
  return $form;
}