You are here

function openlayers_layer_type_openlayers_views_vector::get_features in Openlayers 7.2

Same name and namespace in other branches
  1. 6.2 modules/openlayers_views/includes/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/plugins/layer_types/openlayers_views_vector.inc
Render.

File

modules/openlayers_views/plugins/layer_types/openlayers_views_vector.inc, line 103
OpenLayers Views Vector Layer Type

Class

openlayers_layer_type_openlayers_views_vector

Code

function get_features() {
  if ($view = views_get_view($this->data['views']['view'])) {
    $args = array();

    // Retrieve args/filters from current view
    // to pass on to our vector layer.
    $current_view = views_get_current_view();
    if (!empty($current_view)) {
      $args = $current_view->args;
      if (isset($current_view->exposed_input)) {
        $view
          ->set_exposed_input($current_view->exposed_input);
      }
    }
    if (isset($this->data['views']['arguments'])) {
      $args = $this->data['views']['arguments'];
    }
    $features = $view
      ->execute_display($this->data['views']['display'], $args);

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