You are here

function yamaps_format_values_to_js in Yandex.Maps 8

Same name and namespace in other branches
  1. 7 yamaps.functions.inc \yamaps_format_values_to_js()

Prepares values for js.

Parameters

\Drupal\yamaps\Plugin\Field\FieldType\YamapsFieldType $value: Values of map.

Return value

array Prepared values.

1 call to yamaps_format_values_to_js()
YamapsDefaultFormatter::viewElements in src/Plugin/Field/FieldFormatter/YamapsDefaultFormatter.php
Builds a renderable array for a field value.

File

./yamaps.module, line 20
Yandex Maps module main file.

Code

function yamaps_format_values_to_js(YamapsFieldType $value) {
  return [
    'coords' => isset($value->coords) ? Json::decode($value->coords) : [],
    'type' => $value->coordstype,
    'placemarks' => Json::decode($value->placemarks),
    'lines' => Json::decode($value->lines),
    'polygons' => Json::decode($value->polygons),
  ];
}