mailjet-8.x-2.7/modules/mailjet_stats/src/Controller/StatsAdminController.php

modules/mailjet_stats/src/Controller/StatsAdminController.php
<?php

/**
 * @file
 * Contains \Drupal\mailjet_stats\Controller\StatsAdminController.
 */

namespace Drupal\mailjet_stats\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\mailjet\MailjetApi;
use Symfony\Component\HttpFoundation\RedirectResponse;

class StatsAdminController extends ControllerBase {

  public function content(): array {
    $config_mailjet = $this->config('mailjet.settings');
    if (empty($config_mailjet->get('mailjet_active')) && empty($config_mailjet->get('mailjet_username')) && empty($config_mailjet->get('mailjet_password'))) {
      $this->messenger()
        ->addMessage(t('You need to add your Mailjet API details before you can continue'), 'warning');
      $response = new RedirectResponse('admin/config/mailjet/settings');
      $response->send();
    }

    $mailjetIframe = MailjetApi::getMailjetIframe($config_mailjet->get('mailjet_username'), $config_mailjet->get('mailjet_password'));
    $mailjetIframe->setInitialPage();

    return [
      '#type' => 'inline_template',
      '#template' => '<div id="iframe-main-container" class="iframe-main-container" style="width:100%; height: 1300px;">' . $mailjetIframe->getHtml() . '</div>',
    ];
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc