You are here

function emfield_emfield_widget_settings in Embedded Media Field 5

Same name and namespace in other branches
  1. 6.3 deprecated/emfield-deprecated.inc \emfield_emfield_widget_settings()
  2. 6 emfield.module \emfield_emfield_widget_settings()
  3. 6.2 emfield.module \emfield_emfield_widget_settings()

Widgets *

File

./emfield.module, line 346

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_allow_' . $module . '_' . $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' => $widget['providers'] ? $widget['providers'] : array(),
        '#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',
      );

      //, 'helper_module', );
      foreach (module_implements('emfield_widget_settings_extra') as $module) {
        $columns = array_merge($columns, module_invoke($module, 'emfield_widget_settings_extra', 'save', $widget));
      }
      return $columns;
  }
}