You are here

function _emfield_emfield_widget_settings in Embedded Media Field 6.2

Same name and namespace in other branches
  1. 6.3 emfield.cck.inc \_emfield_emfield_widget_settings()
  2. 6.3 deprecated/emfield-deprecated.cck.inc \_emfield_emfield_widget_settings()
  3. 6 emfield.cck.inc \_emfield_emfield_widget_settings()
1 call to _emfield_emfield_widget_settings()
emfield_emfield_widget_settings in ./emfield.module
Widgets *

File

./emfield.cck.inc, line 125
Helper functions to implement our various cck-required functions, such as hook_field and hook_widget.

Code

function _emfield_emfield_widget_settings($op, $widget, $module) {
  switch ($op) {
    case 'form':

      // Make sure to register the new type as supported by this module.
      emfield_implement_types(FALSE);
      $form = array();
      $options = array();
      $providers = emfield_system_list($module);
      foreach ($providers as $provider) {
        if (variable_get('emfield_' . $module . '_allow_' . $provider->name, TRUE)) {
          $info = emfield_include_invoke($module, $provider->name, 'info');
          $options[$provider->name] = $info['name'];
        }
      }
      $form['provider_list'] = array(
        '#type' => 'fieldset',
        '#title' => t('Providers Supported'),
        '#description' => t('Select which third party providers you wish to allow for this content type from the list below. If no checkboxes are checked, then all providers will be supported. When a user submits new content, the URL they enter will be matched to the provider, assuming that provider is allowed here.'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
      );
      $form['provider_list']['providers'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Providers'),
        '#default_value' => empty($widget['providers']) ? array() : $widget['providers'],
        '#options' => $options,
      );
      foreach (module_implements('emfield_widget_settings_extra') as $module) {
        $form[$module] = module_invoke($module, 'emfield_widget_settings_extra', 'form', $widget);
      }
      return $form;
    case 'save':
      $columns = array(
        'providers',
      );
      foreach (module_implements('emfield_widget_settings_extra') as $module) {
        $module_invoke = module_invoke($module, 'emfield_widget_settings_extra', 'save', $widget);
        $module_invoke = (array) $module_invoke;
        $columns = array_merge($columns, $module_invoke);
      }
      return $columns;
  }
}