_field_get_formatter

  1. drupal
    1. drupal7
Versionen
drupal7 _field_get_formatter($display, $field)

Return valid formatter type and settings.

Backs up to default formatter and settings if the intended formatter is no longer available. This might happen when the formatter has been renamed in the module, or if the module has been disabled since then.

Verwandte Themen

▾ 2 functions call _field_get_formatter()

field_default_view in modules/field/field.default.inc
The 'view' operation constructs the $object in a way that you can use drupal_render() to display the formatted output for an individual field. i.e. print drupal_render($object->content['field_foo']);
field_format in modules/field/field.module
Format a field item for display.

Code

modules/field/field.info.inc, line 26

<?php
function _field_get_formatter($display, $field) {
  if ($display['type'] != 'hidden') {
    $formatter_type = field_info_formatter_types($display['type']);
    if (empty($formatter_type)) {
      $field_type = field_info_field_types($field['type']);
      $display['type'] = $field_type['default_formatter'];
      $formatter_type = field_info_formatter_types($display['type']);
    }
    $function = $formatter_type['module'] . '_field_formatter_settings';
    if (drupal_function_exists($function)) {
      $display['settings'] += $function($display['type']);
    }
  }
  return $display;
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen