Skip to main content
added 1351 characters in body
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

There isn't a preset list of widget types; the widget types are the ones defined from modules that implement fields. Using the following code, you can get the list of all the widget types implemented by the enabled modules:

$array = module_invoke_all('field_info');

foreach ($array as $id => $info) {
  print $info['default_widget'];
}

The code essentially invokes all the implementations of hook_field_info(), and print what is defined as default widget.
If you have installed Devel, instead of print you can use dsm().

If you want to know the settings available for the field implementation, then you need to look for the implementation of hook_field_settings_form(), such as list_field_settings_form(), or text_field_settings_form().

function text_field_settings_form($field, $instance, $has_data) {
  $settings = $field['settings'];

  $form = array();

  if ($field['type'] == 'text') {
    $form['max_length'] = array(
      '#type' => 'textfield', 
      '#title' => t('Maximum length'), 
      '#default_value' => $settings['max_length'], 
      '#required' => TRUE, 
      '#description' => t('The maximum length of the field in characters.'), 
      '#element_validate' => array('_element_validate_integer_positive'),
      // @todo: If $has_data, add a validate handler that only allows
      // max_length to increase. 
      '#disabled' => $has_data,
    );
  }

  return $form;
}

There isn't a preset list of widget types; the widget types are the ones defined from modules that implement fields. Using the following code, you can get the list of all the widget types implemented by the enabled modules:

$array = module_invoke_all('field_info');

foreach ($array as $id => $info) {
  print $info['default_widget'];
}

The code essentially invokes all the implementations of hook_field_info(), and print what is defined as default widget.
If you have installed Devel, instead of print you can use dsm().

There isn't a preset list of widget types; the widget types are the ones defined from modules that implement fields. Using the following code, you can get the list of all the widget types implemented by the enabled modules:

$array = module_invoke_all('field_info');

foreach ($array as $id => $info) {
  print $info['default_widget'];
}

The code essentially invokes all the implementations of hook_field_info(), and print what is defined as default widget.
If you have installed Devel, instead of print you can use dsm().

If you want to know the settings available for the field implementation, then you need to look for the implementation of hook_field_settings_form(), such as list_field_settings_form(), or text_field_settings_form().

function text_field_settings_form($field, $instance, $has_data) {
  $settings = $field['settings'];

  $form = array();

  if ($field['type'] == 'text') {
    $form['max_length'] = array(
      '#type' => 'textfield', 
      '#title' => t('Maximum length'), 
      '#default_value' => $settings['max_length'], 
      '#required' => TRUE, 
      '#description' => t('The maximum length of the field in characters.'), 
      '#element_validate' => array('_element_validate_integer_positive'),
      // @todo: If $has_data, add a validate handler that only allows
      // max_length to increase. 
      '#disabled' => $has_data,
    );
  }

  return $form;
}
it would be cleared if I would have written "fields," instead of "fieds"
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

There isn't a preset list of widget types; the widget types are the ones defined from modules that define fiedsimplement fields. Using the following code, you can get the list of all the widget types implemented by the enabled modules:

$array = module_invoke_all('field_info');

foreach ($array as $id => $info) {
  print $info['default_widget'];
}

The code essentially invokes all the implementations of hook_field_info(), and print what is defined as default widget.
If you have installed Devel, instead of print you can use dsm().

There isn't a preset list of widget types; the widget types are the ones defined from modules that define fieds. Using the following code, you can get the list of all the widget types implemented by the enabled modules:

$array = module_invoke_all('field_info');

foreach ($array as $id => $info) {
  print $info['default_widget'];
}

The code essentially invokes all the implementations of hook_field_info(), and print what defined as default widget.
If you have installed Devel, instead of print you can use dsm().

There isn't a preset list of widget types; the widget types are the ones defined from modules that implement fields. Using the following code, you can get the list of all the widget types implemented by the enabled modules:

$array = module_invoke_all('field_info');

foreach ($array as $id => $info) {
  print $info['default_widget'];
}

The code essentially invokes all the implementations of hook_field_info(), and print what is defined as default widget.
If you have installed Devel, instead of print you can use dsm().

Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

There isn't a preset list of widget types; the widget types are the ones defined from modules that define fieds. Using the following code, you can get the list of all the widget types implemented by the enabled modules:

$array = module_invoke_all('field_info');

foreach ($array as $id => $info) {
  print $info['default_widget'];
}

The code essentially invokes all the implementations of hook_field_info(), and print what defined as default widget.
If you have installed Devel, instead of print you can use dsm().