<?php

namespace Drupal\pano_maps\Plugin\Block;

use Drupal\Core\Block\BlockBase;

/**
 * Provides a block for showing panoramic map of improvements.
 *
 * @Block(
 *   id = "pano_maps_improvements_block",
 *   admin_label = @Translation("Panoramic map of Improvements"),
 * )
 */
class PanoMapsImprovementsBlock extends BlockBase {

  /**
   * {@inheritdoc}
   */
  public function label():string {
    return "Panoramic map of Improvements";
  }

  /**
   * {@inheritdoc}
   */
  public function build():array {

    $module_handler = \Drupal::service('module_handler');
    $module_path = $module_handler->getModule('pano_maps')->getPath();

    return [
      '#attached' => [
        'library' => [
          'pano_maps/improvements',
        ],
        'drupalSettings' => [
          'pano_maps' => [
            'path' => $module_path,
          ],
        ],
      ],
      '#theme' => 'pano_maps',
      '#element' => [],
    ];
  }

}
