private function yamaps_views_plugin_style_default_map::overridePlacemarkTitle in Yandex.Maps 7
Override Placemark title.
Parameters
int $placemark: Placemark.
int $row_index: Row index.
array $row: Row.
1 call to yamaps_views_plugin_style_default_map::overridePlacemarkTitle()
- yamaps_views_plugin_style_default_map::render in modules/
yamaps_views/ handlers/ yamaps_views_plugin_style_default_map.inc - Renders the map.
File
- modules/
yamaps_views/ handlers/ yamaps_views_plugin_style_default_map.inc, line 796 - Class yamaps_views_plugin_style_default_map.
Class
- yamaps_views_plugin_style_default_map
- Class defines Yandex Maps style plugin handler.
Code
private function overridePlacemarkTitle(&$placemark, $row_index, array $row) {
if (isset($this->options['placemark_title'], $this->view->field[$this->options['placemark_title']]) && $this->options['placemark_title'] !== self::PLACEMARK_DEFAULT_FIELD) {
// Prepare placemark title.
$marker_title = $this
->preparePlacemarkTitle($row_index);
$field_title_settings = $this->view->field[$this->options['placemark_title']];
if (isset($field_title_settings->field_info['type'])) {
switch ($field_title_settings->field_info['type']) {
case 'image':
if (isset($row->{'field_' . $this->options['placemark_title']}[0]['rendered']['#image_style'], $row->{'field_' . $this->options['placemark_title']}[0]['raw']['uri'])) {
// Special logic for image fields.
// Placemark type.
$placemark['options']['iconLayout'] = 'default#image';
// Image href.
$placemark['options']['iconImageHref'] = image_style_url($row->{'field_' . $this->options['placemark_title']}[0]['rendered']['#image_style'], $row->{'field_' . $this->options['placemark_title']}[0]['raw']['uri']);
$image_dimensions = getimagesize($placemark['options']['iconImageHref']);
// Placemark image size.
$placemark['options']['iconImageSize'] = [
$image_dimensions[0],
$image_dimensions[1],
];
// Icon image offset of upper left angle.
$placemark['options']['iconImageOffset'] = [
-($image_dimensions[0] / 2),
$image_dimensions[1] * 0.1 - $image_dimensions[1],
];
}
else {
$this
->prepareDefaultPlacemarkTitle($placemark, $marker_title);
}
break;
default:
$this
->prepareDefaultPlacemarkTitle($placemark, $marker_title);
break;
}
}
else {
$this
->prepareDefaultPlacemarkTitle($placemark, $marker_title);
}
}
}