You are here

function fivestar_field_widget_settings_form in Fivestar 7.2

Implements hook_field_widget_settings_form().

File

includes/fivestar.field.inc, line 253
Provides CCK integration for fivestar module.

Code

function fivestar_field_widget_settings_form($field, $instance) {
  $form = array();
  if ($instance['widget']['type'] == 'stars') {
    $form['widget'] = array(
      '#tree' => TRUE,
      '#type' => 'fieldset',
      '#title' => t('Star display options'),
      '#description' => t('Choose a style for your widget.'),
      '#weight' => -2,
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $widgets = module_invoke_all('fivestar_widgets');
    $form['widget']['fivestar_widget'] = array(
      '#type' => 'radios',
      '#options' => array(
        'default' => t('Default'),
      ) + $widgets,
      '#default_value' => isset($instance['widget']['settings']['widget']['fivestar_widget']) ? $instance['widget']['settings']['widget']['fivestar_widget'] : 'default',
      '#attributes' => array(
        'class' => array(
          'fivestar-widgets',
          'clearfix',
        ),
      ),
      '#pre_render' => array(
        'fivestar_previews_expand',
      ),
      '#attached' => array(
        'css' => array(
          drupal_get_path('module', 'fivestar') . '/css/fivestar-admin.css',
        ),
      ),
    );
  }
  return $form;
}