function hook_field_widget_info

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 field.api.php hook_field_widget_info()
cle7 field.api.php hook_field_widget_info()
elmsmedia7 field.api.php hook_field_widget_info()
icor7 field.api.php hook_field_widget_info()
meedjum_blog7 field.api.php hook_field_widget_info()
mooc7 field.api.php hook_field_widget_info()

Expose Field API widget types.

Return value

An array describing the widget types implemented by the module. The keys are widget type names. To avoid name clashes, widget type names should be prefixed with the name of the module that exposes them. The values are arrays describing the widget type, with the following key/value pairs:

  • label: The human-readable name of the widget type.
  • description: A short description for the widget type.
  • field types: An array of field types the widget supports.
  • settings: An array whose keys are the names of the settings available for the widget type, and whose values are the default values for those settings.
  • behaviors: (optional) An array describing behaviors of the widget, with the following elements:

    • multiple values: One of the following constants:

      • FIELD_BEHAVIOR_DEFAULT: (default) If the widget allows the input of one single field value (most common case). The widget will be repeated for each value input.
      • FIELD_BEHAVIOR_CUSTOM: If one single copy of the widget can receive several field values. Examples: checkboxes, multiple select, comma-separated textfield.
    • default value: One of the following constants:
  • weight: (optional) An integer to determine the weight of this widget relative to other widgets in the Field UI when selecting a widget for a given field instance.

See also

hook_field_widget_info_alter()

hook_field_widget_form()

hook_field_widget_form_alter()

hook_field_widget_WIDGET_TYPE_form_alter()

hook_field_widget_error()

hook_field_widget_settings_form()

Related topics

25 functions implement hook_field_widget_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

date_field_widget_info in sites/all/modules/ulmus/date/date.field.inc
Implements hook_field_widget_info().
email_field_widget_info in sites/all/modules/ulmus/email/email.module
Implements hook_field_widget_info().
entityreference_field_widget_info in sites/all/modules/ulmus/entityreference/entityreference.module
Implements hook_field_widget_info().
field_collection_fieldset_field_widget_info in sites/all/modules/ulmus/field_collection_fieldset/field_collection_fieldset.module
Implements hook_field_widget_info().
field_collection_field_widget_info in sites/all/modules/ulmus/field_collection/field_collection.module
Implements hook_field_widget_info().

... See full list

2 invocations of hook_field_widget_info()
field_help in modules/field/field.module
Implements hook_help().
_field_info_collate_types in modules/field/field.info.inc
Collates all information on field types, widget types and related structures.

File

modules/field/field.api.php, line 754

Code

function hook_field_widget_info() {
  return array(
    'text_textfield' => array(
      'label' => t('Text field'),
      'field types' => array('text'),
      'settings' => array('size' => 60),
      'behaviors' => array(
        'multiple values' => FIELD_BEHAVIOR_DEFAULT,
        'default value' => FIELD_BEHAVIOR_DEFAULT,
      ),
    ),
    'text_textarea' => array(
      'label' => t('Text area (multiple rows)'),
      'field types' => array('text_long'),
      'settings' => array('rows' => 5),
      'behaviors' => array(
        'multiple values' => FIELD_BEHAVIOR_DEFAULT,
        'default value' => FIELD_BEHAVIOR_DEFAULT,
      ),
    ),
    'text_textarea_with_summary' => array(
      'label' => t('Text area with a summary'),
      'field types' => array('text_with_summary'),
      'settings' => array(
        'rows' => 20,
        'summary_rows' => 5,
      ),
      'behaviors' => array(
        'multiple values' => FIELD_BEHAVIOR_DEFAULT,
        'default value' => FIELD_BEHAVIOR_DEFAULT,
      ),
      
      // As an advanced widget, force it to sink to the bottom of the choices.
      'weight' => 2,
    ),
  );
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.