W3cubDocs

/Drupal 8

function hook_field_info_alter

hook_field_info_alter(&$info)

Perform alterations on Field API field types.

Parameters

$info: Array of information on field types as collected by the "field type" plugin manager.

Related topics

Field Types API
Defines field, widget, display formatter, and storage types.
Hooks
Define functions that alter the behavior of Drupal core.

File

core/modules/field/field.api.php, line 54
Field API documentation.

Code

function hook_field_info_alter(&$info) {
  // Change the default widget for fields of type 'foo'.
  if (isset($info['foo'])) {
    $info['foo']['default widget'] = 'mymodule_widget';
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!field!field.api.php/function/hook_field_info_alter/8.1.x