You are here

function yamaps_views_page_alter in Yandex.Maps 7

Implements hook_page_alter().

File

modules/yamaps_views/yamaps_views.module, line 18
Adds a formatter for view and create view button.

Code

function yamaps_views_page_alter(&$page) {
  if (substr_count(current_path(), 'admin/structure/views/view/')) {
    global $language;
    $api_url = url(YAMAPS_API_URL, [
      'absolute' => TRUE,
      'query' => [
        'load' => 'package.full',
        'lang' => YAMAPS_API_LANGUAGE,
        'wizard' => 'Drupal_yamaps_' . $language->language,
        'apikey' => variable_get('yamaps_api_key', ''),
      ],
    ]);

    // Load 'Yandex.Maps' API in views admin UI to make sure that it is
    // fully loaded before calling it during views ajax operations.
    $page['content']['#attached']['js'][] = $api_url;
  }
}