You are here

function embonus_emfield_widget_settings_extra in Embedded Media Field 6.2

Implementation of hook_emfield_widget_settings_extra().

File

contrib/embonus/embonus.module, line 6

Code

function embonus_emfield_widget_settings_extra($op, $widget) {
  static $collect;
  if (!isset($collect)) {

    // We only collect the collect start/end times if requested by a module
    // that implements hook_embonus_collect_start_end_times() and returns TRUE.
    foreach (module_implements('embonus_collect_start_end_times') as $module) {
      $collect = $collect || module_invoke($module, 'embonus_collect_start_end_times', $widget);
    }
  }
  if ($collect) {
    switch ($op) {
      case 'form':
        $form = array();
        $form['collect_start_end_times'] = array(
          '#type' => 'checkbox',
          '#title' => t('Collect start & end times'),
          '#description' => t('Some providers may respect start and end times when displaying media. Check this box if you wish to collect that information on a per-instance basis.'),
          '#default_value' => isset($widget['collect_start_end_times']) ? $widget['collect_start_end_times'] : FALSE,
        );
        return $form;
      case 'save':
        return array(
          'collect_start_end_times',
        );
    }
  }
}