You are here

function openlayers_layer_type_openlayers_views_vector::get_features in Openlayers 6.2

Same name and namespace in other branches
  1. 7.2 modules/openlayers_views/plugins/layer_types/openlayers_views_vector.inc \openlayers_layer_type_openlayers_views_vector::get_features()

Get features for this view

Parameters

$view_name: the view name

$display_name: the view display name

Return value

array of features

1 call to openlayers_layer_type_openlayers_views_vector::get_features()
openlayers_layer_type_openlayers_views_vector::render in modules/openlayers_views/includes/layer_types/openlayers_views_vector.inc
Render.

File

modules/openlayers_views/includes/layer_types/openlayers_views_vector.inc, line 37
OpenLayers Views Vector Layer Type

Class

openlayers_layer_type_openlayers_views_vector
@file OpenLayers Views Vector Layer Type

Code

function get_features($view_name, $display_name) {
  if ($view = views_get_view($view_name)) {
    $args = array();

    // Retrieve args/filters from current view
    // to pass on to our vector layer.
    $current_view = views_get_current_view();
    if (isset($current_view)) {
      $args = isset($current_view->args) ? $current_view->args : array();
      if (isset($current_view->exposed_input)) {
        $view
          ->set_exposed_input($current_view->exposed_input);
      }
    }
    $features = $view
      ->execute_display($display_name, $args);

    // Get dynamic title from view
    $this->title = $view
      ->get_title();
    $view
      ->destroy();
  }
  return isset($features) ? $features : array();
}