You are here

function itoggle_field_field_widget_settings_form in iToggle 7.2

Implements hook_field_widget_settings_form().

File

modules/field/itoggle_field.module, line 71
iToggle Field module.

Code

function itoggle_field_field_widget_settings_form($field, $instance) {
  $form = array();
  if ($instance['widget']['type'] === 'itoggle_widget') {
    $form['itoggle_settings'] = array(
      '#type' => 'fieldset',
      '#title' => t('iToggle'),
      '#collapsible' => FALSE,
      '#weight' => -1,
      '#tree' => TRUE,
      '#attached' => array(
        'css' => array(
          drupal_get_path('module', 'itoggle_field') . '/itoggle_field.css',
        ),
        'js' => array(
          drupal_get_path('module', 'itoggle_field') . '/itoggle_field.js',
        ),
      ),
    );
    $clickable = $instance['widget']['settings']['clickable'];
    $display_type = $instance['widget']['settings']['display_type'];
    $options_form = itoggle_get_options_form($clickable, $display_type);

    // Wrap the form in a fieldset.
    foreach ($options_form as $key => $value) {
      $form['itoggle_settings'][$key] = $value;
    }
  }
  return $form;
}