You are here

function jplayer_style_plugin::options_form in jPlayer 7.2

Same name and namespace in other branches
  1. 6 includes/jplayer_style_plugin.inc \jplayer_style_plugin::options_form()

Provide a form to edit options for this plugin.

Overrides views_plugin_style::options_form

File

includes/jplayer_style_plugin.inc, line 29
Display style plugin for Views that renders rows as a jPlayer playlist.

Class

jplayer_style_plugin
Style plugin to display a jPlayer playlist.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);

  // Build a list of all fields.
  $options = array();
  foreach ($this->display->handler
    ->get_handlers('field') as $field => $handler) {
    if ($label = $handler
      ->label()) {
      $options[$field] = $label;
    }
    else {
      $options[$field] = $handler
        ->ui_name();
    }
  }
  if (empty($options)) {
    $options[''] = t('No available fields');
  }
  $form['path_field'] = array(
    '#type' => 'select',
    '#title' => t('File path fields'),
    '#options' => $options,
    '#multiple' => TRUE,
    '#size' => 4,
    '#default_value' => $this->options['path_field'],
    '#description' => t('Select the fields that will contain a file path to an mp3 file. If multiple fields are selected, the first one that contains a value will be used. This field will be hidden from view unless there are no other fields visible'),
    '#weight' => -5,
  );

  // Get the formatter settings into the options form.
  $field = 'jplayer_view_pseudo_field';
  $instance = array(
    'display' => array(
      'view' => array(
        'type' => 'jplayer_player',
        'settings' => $this->options,
      ),
    ),
  );
  $form += jplayer_field_formatter_settings_form($field, $instance, 'view', $form, $form_state);
}