function custom_formatters_field_formatter_view in Custom Formatters 7.2
Implements hook_field_formatter_view().
4 calls to custom_formatters_field_formatter_view()
- custom_formatters_ds_entity_variables in includes/
ds.inc - Format variables on an entity.
- custom_formatters_ds_render_field in includes/
ds.inc - Display Suite render function for Custom Formatters integration.
- custom_formatters_export_ui_form_js_preview in plugins/
export_ui/ custom_formatters.inc - AJAX callback form Custom formatters preview form.
- custom_formatters_insert_content in includes/
insert.inc - Implements hook_insert_content().
File
- includes/
field.inc, line 104 - Field module integration.
Code
function custom_formatters_field_formatter_view($obj_type, $object, $field, $instance, $langcode, $items, $display, $formatter = NULL) {
$element = array();
/** @var stdClass $formatter */
$formatter = empty($formatter) ? custom_formatters_crud_load(drupal_substr($display['type'], 18)) : $formatter;
if (isset($formatter) && !empty($items)) {
$engines = module_invoke_all('custom_formatters_engine_info');
$engine = $formatter->mode;
if (isset($engines[$engine]['file']) && file_exists($engines[$engine]['file'])) {
require_once $engines[$engine]['file'];
}
if (function_exists($function = $engines[$engine]['callbacks']['render'])) {
$element = $function($formatter, $obj_type, $object, $field, $instance, $langcode, $items, $display);
if (!$element) {
return FALSE;
}
if (is_string($element)) {
$element = array(
array(
'#markup' => $element,
),
);
}
foreach (element_children($element) as $delta) {
$element[$delta]['#cf_options'] = isset($display['#cf_options']) ? $display['#cf_options'] : array();
}
}
// Allow other modules to modify the element.
drupal_alter('custom_formatters_field_formatter_view_element', $element, $formatter);
}
return $element;
}