You are here

public function field_timer_county_base::renderItems in Field Timer 7.2

@inheritdoc

Overrides field_timer_formatter_interface::renderItems

1 call to field_timer_county_base::renderItems()
field_timer_county_date_field_base::renderItems in includes/field_timer_county.inc
@inheritdoc
1 method overrides field_timer_county_base::renderItems()
field_timer_county_date_field_base::renderItems in includes/field_timer_county.inc
@inheritdoc

File

includes/field_timer_county.inc, line 130
Help file. Contains help classes to perform field_timer_county formatter related actions.

Class

field_timer_county_base
Base class for field_timer_county formatter.

Code

public function renderItems($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  if (!$this
    ->loadLibrary()) {
    return array();
  }
  $info = entity_get_info($entity_type);
  $id_key = $info['entity keys']['id'];
  $elements = array();
  $settings = $display['settings'];
  foreach ($items as $delta => $item) {
    $elements[$delta] = array(
      '#type' => 'markup',
      '#markup' => '<div id="county-' . $entity_type . '_' . $entity->{$id_key} . '_' . $field['field_name'] . '_' . $delta . '" ' . 'style="background: ' . $settings['background'] . ';"></div>',
    );
  }
  $this
    ->loadJSandCSS($entity_type, $entity, $field, $instance, $langcode, $items, $display);
  return $elements;
}