You are here

function embonus_emfield_widget_extra in Embedded Media Field 6.2

Implementation of hook_emfield_widget_extra().

File

contrib/embonus/embonus.module, line 48

Code

function embonus_emfield_widget_extra(&$form, &$form_state, $field, $items, $delta, $module) {
  if ($field['widget']['collect_start_end_times']) {
    $tree['start_end_times'] = array(
      '#type' => 'fieldset',
      '#title' => t('Start & end times'),
      '#description' => t('Some providers may respect start and end times when displaying the media. If you enter those times here, then the media will be truncated to those times when displayed, if possible.'),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
    );
    $tree['start_end_times']['start_time'] = array(
      '#type' => 'textfield',
      '#title' => t('Start time'),
      '#description' => t('Please enter the time, in seconds or mm:ss format, that you wish to start display of the media here. Leave blank to start at the beginning.'),
      '#default_value' => isset($items[$delta]['start_time']) && $items[$delta]['start_time'] ? embonus_seconds_to_time($items[$delta]['start_time']) : '',
    );
    $tree['start_end_times']['end_time'] = array(
      '#type' => 'textfield',
      '#title' => t('End time'),
      '#description' => t('Please enter the time, in seconds or mm:ss format, that you wish to end display of the media here. Leave blank to end at the end.'),
      '#default_value' => isset($items[$delta]['end_time']) && $items[$delta]['end_time'] ? embonus_seconds_to_time($items[$delta]['end_time']) : '',
    );
    return $tree;
  }
}